Tagged: button
-
AuthorPosts
-
March 28, 2023 at 1:22 pm #1402783
Hi, how can I turn Enfold’s button or button raw into specific heading tag?
For instance, I want to make specific button h1. How can I do so?
March 29, 2023 at 7:14 pm #1402956Hey Jacopotj,
I think it would be easier if you added a custom class to the heading in question, then applied styling to it to make it look like a button.
Best regards,
RikardMarch 30, 2023 at 8:38 am #1402989I prefer other way around. Can you explain me how to achieve that?
Many thanks
March 30, 2023 at 11:42 pm #1403052April 1, 2023 at 11:42 am #1403179so many snippets. Which one to use? Link me the specific answer kindly
April 1, 2023 at 4:56 pm #1403219just read
if you only want to replace specific button text : give a custom class to that button – this class will be on the wrapper – so :
so the top one is – if you like to change all x-large buttons to h4 tags.
but if you like to decide from time to time – give those example classes to your button : is-h1, is-h2, is-h3 etc.
then the snippet at the end will do the job.April 20, 2023 at 4:00 pm #1405052Thanks. But in this case
function id_to_button_row_buttons(){ ?> <script> (function($) { $('.avia-buttonrow-wrap').each(function(a){ var ButtonRowID = ($(this).attr('id') !== undefined) ? $(this).attr('id') : 'button_row'+(a+1); var that = this; $('.avia-button', this).each(function(i){ $(this).attr('id', ButtonRowID+'-button'+(i+1)); }); }); })(jQuery); </script> <?php } add_action( 'wp_footer', 'id_to_button_row_buttons');
What is the css class id I need to replace? Also I don’t see wheere I can pick what h1/h2 etc tag is it. Sorry the confusion
Because from what I understand, then I need to use css class id on button and it will get h2 or h3 etc heading tag.April 20, 2023 at 4:08 pm #1405054April 20, 2023 at 10:42 pm #1405093these are custom classes to set by yourself: is-h1; is-h2 etc. because you can remember that better than other classnames.
so that snippet:function replace_tags_with_tags(){ ?> <script> (function($) { function replaceElementTag(targetSelector, newTagString) { $(targetSelector).each(function(){ var newElem = $(newTagString, {html: $(this).html()}); $.each(this.attributes, function() { newElem.attr(this.name, this.value); }); $(this).replaceWith(newElem); }); } // f.e.: custom-class expresses the h-tag you like to get replaceElementTag('.avia-button-wrap.is-h1 .avia-button .avia_iconbox_title', '<h1></h1>'); replaceElementTag('.avia-button-wrap.is-h2 .avia-button .avia_iconbox_title', '<h2></h2>'); replaceElementTag('.avia-button-wrap.is-h3 .avia-button .avia_iconbox_title', '<h3></h3>'); replaceElementTag('.avia-button-wrap.is-h4 .avia-button .avia_iconbox_title', '<h4></h4>'); }(jQuery)); </script> <?php } add_action('wp_footer', 'replace_tags_with_tags');
will only work if you think of to set that custom class to that button
________
the script for the button-row to have unique ids on the buttons inside a button row is just to select easily those buttons.
Otherwise you had to work with something like this: .avia-button:nth-of-type(2) etc.so if you got an ID on a button-row abc – the first button of that row will have the ID: abc-button1 etc.
then you can add a new line to the script above:replaceElementTag('#abc-button1 .avia_iconbox_title', '<h1></h1>'); replaceElementTag('#abc-button2 .avia_iconbox_title', '<h2></h2>'); replaceElementTag('#abc-button3 .avia_iconbox_title', '<h3></h3>');
I don’t think it makes sense for buttons and certainly not for a button row; but if you want it, I’ll show you how to force it ;)
see again a button row with all the codes here: https://webers-testseite.de/buttonrow/
April 21, 2023 at 5:37 pm #1405187Sorry but I struggle to follow you. :)
To start off, when using button row, I don’t see the option to add custom css class, to individual buttons. Hence, I believe the only way to change a button’s row heading tags is by using whole the button row.
So, to change a specific the heading tags of the buttons of a button row to H2 or something else, by custom css class (see here: https://ibb.co/KDH0pcf) which snippet do I add?
Of course, if there is easier ways to do so I am open to suggestions. But please tell where I need to but “abc” as per linked image screenshot example in the snippet.
April 22, 2023 at 9:11 am #1405214So – if you follow my instructions – also at the example page – you can see that it works. Even though I do not think this is recommendable.
First of all, you don’t seem to have grasped the difference between classes and ids.
So if you follow the description you will see that I have assigned an ID to the button row and not a class.There is no option on the button-row element to give different classes or id’s to the single button in a row.
You are only able to do that for the wrapping container. That is the reason for the first snippet:
It passes this assigned ID to the child elements ( avia-button) in combination with an index, so that each avia-button now has a unique ID.( click to enlarge the image:)
on that screenshot you see that the ID of the button row will be found on each button ( part of that row ) as a unique ID for each Button with a littel addendum ( – button1; -butten2 etc. )
As already mentioned above, you could of course select the individual buttons in the row by count them.
an expression like this will do the selection too:#abc .avia-button:nth-of-type(1) .avia_iconbox_title
__________________________________
Here now my closing comment:
It is generally not recommended to include an H1 tag within an anchor tag. The H1 tag is typically used to indicate the main heading of a webpage, and it is best to reserve it for that purpose. Using an H1 tag within an anchor tag could be seen as a misuse of the tag, and could potentially harm your SEO efforts. Additionally, search engines may not be able to understand the context of the H1 tag if it is used in this way.
It is best to stick to using anchor tags for linking purposes, and using H1 tags for headings.If you only like to have bigger font-sizes inside a “button” – there are other better and easier ways to obtain it.
-
AuthorPosts
- You must be logged in to reply to this topic.