Jump to content


Replying to Add/modify Html To Buttons


Post Options

  or Cancel


Topic Summary

Posted 30 April 2014 - 12:02 PM

Hi @Ronald,

Sorry for the confusion.

Yes, I want to avoid using JS to add a class to a form element. I would rather be able to go into a template for that element and add the class via HTML instead.

For the front-end, for visitors/non-registered/non-paid users, I am able to take the source code and copy/paste and replace the code in a template, adding a class and thus utilizing the predefined styles.

However, for the logged in users/registered/paid users, I am unable to take the source code and copy/paste in a template because the field values are dynamic with user information, therefore, I was asking if there was a way to overcome that via some kind of template that I could modify to accomplish that.

If I could avoid modifying the core to accomplish that, it would be awesome; if there is no other option other than to add javascript to make it happen for logged in users, then I will have no choice but to do that.

When I said I used some javascript to add classes to form elements, I was only trying to say that I managed to do that too, but hoping to avoid. Again, my apologies for the misunderstanding.

If adding JS is the best and only options, let me know, thanks.

Ronald

Posted 30 April 2014 - 03:58 AM

Hi,

I'm not sure I understand. First, I was under the impression you didn't want to use JS, but since you already are, why can't you use it for these fields? And, if the css selectors are available, and allow you to accomplish the styling, why not use that? It seems that there are 2 viable working options, and of course you could edit Exchange (core) code as a 3rd option, but it would be the least favourable.

Ronald

Posted 28 April 2014 - 04:17 PM

Hi @Ronald,

Thanks for your reply. I am able to target the body class for the page and it's element for the CSS. I am using Bootstrap for my custom theme and the reason I'm trying to add a class to a form element(s) is because the styles are there from Bootstrap, and I don't want to recreate the styles for the elements if I can simply assign the class with the styles to the element already.

You will need to be logged in to see the element I'd like to add the class to. I can set up a test user and email it to you if you need to see it. For some of the elements, I already had to use jQuery to add the class (even though I was trying to avoid it). Thanks.

Ronald

Posted 28 April 2014 - 03:35 PM

Hi Thomas,

WordPress adds a class to the body tag for logged in users. Can you not use that?

If not, can you add a link to your site, the page this concerns. I can then have a closer look,

Ronald

Posted 26 April 2014 - 10:23 AM

Hi @Ronald,

I have tried it and I am able to modify the elements for visitors via the source code; however, for the form fields I am not able to do that for registered/logged in customers as the values are dynamic and different. Do you know if there's any way I can add a class to form elements for logged in customers? An example would be for the email address field when a customer has registered and is logged in. I would like to add an arbitrary class of "foo" to the input. Thanks in advance.

Regards,
Thomas

Posted 25 April 2014 - 09:47 AM

Hi @Ronald,

I haven't tried that out - I'll give it a shot. I guess I figured there would be some code that's been prebuilt and I can override in the templates somewhere.

Regards,
Thomas

Ronald

Posted 25 April 2014 - 04:23 AM

Hi,

perhaps the easiest is to comment out that code or remove it, so that it doesn't execute, and replace it by your own html code. You should be able to find the html code when you view the source code of your site, and copy and paste the relevant block of code.

You should create a copy of the template file using the same path in an exchange folder in your child theme folder. It will then override the one use by Exchange.

won't that work for you?
Ronald

Posted 24 April 2014 - 09:40 PM

Hi,

In the individual template files such as the save.php (code provided below):

<?php do_action( 'it_exchange_content_profile_before_save_button_element' ); ?>
<div class="it-exchange-customer-save it-exchange-profile-save">
<?php it_exchange( 'customer', 'save' ); ?>
</div>
<?php do_action( 'it_exchange_content_profile_after_save_button_element' ); ?>

Is there any way to add/modify the html for:
<?php it_exchange( 'customer', 'save' ); ?>

It outputs as html with the input for Save, but what I'd like to do is add a class to the element somehow without using javascript/jQuery. Is that possible?

Thanks.

Review the complete topic (launches new window)