
-
AuthorPosts
-
January 3, 2020 at 6:51 pm #1170098
Hi,
the standard heading for a post is h2.
Unfortunately, this heading is also a h2 heading if I place a blog entry on another page, which shows only the first entry.
In this case, I have two h2, (one from the original page and one from the blog window) which I don´t wanna have.
So, I would like to change the standard headingh fopr a blog entry to h4.
Any ideas?
Thanks in advanceJanuary 3, 2020 at 7:09 pm #1170102Hey megamazl,
Could you please give us a link to your website, we need more context to be able to help you.
Best regards,
VictoriaJanuary 3, 2020 at 9:10 pm #1170121This reply has been marked as private.January 3, 2020 at 11:09 pm #1170139Hi megamazl,
Could you please attach some screenshots of the issue?
Best regards,
VictoriaJanuary 3, 2020 at 11:21 pm #1170147Yes, and also to my front page.
There is the same heading as in the news page.
At the news page, a h2 is ok, but on my front page a h2 is bad for SEOLike i said, I changed it in another PHP file, but I think with an update, my changes will be overwritten.
January 3, 2020 at 11:38 pm #1170153Hi megamazl,
Thank you :)
Best regards,
VictoriaJanuary 3, 2020 at 11:42 pm #1170155I changed it to h5 inside a PHP file. But the enfold standard is a h2.
With the next update of enfold, my changes will be overwritten.January 4, 2020 at 6:35 pm #1170308Hi,
It looks like you are using a blog element inside of a 1/4 column to simulate a sidebar on your homepage, is this correct?
I imagine you don’t want the blog element to show the post titles as h5 everywhere it might be used, only in this situation, is that correct?
We could help with a function that would change the heading size whenever it is used inside of a column that contains a custom class so that you can use this on multiple pages, would that help?Best regards,
MikeJanuary 5, 2020 at 2:35 pm #1170442It looks like you are using a blog element inside of a 1/4 column to simulate a sidebar on your homepage, is this correct?
I imagine you don’t want the blog element to show the post titles as h5 everywhere it might be used, only in this situation, is that correct?This is correct.
Your function would help.thanks in advance
January 5, 2020 at 7:02 pm #1170489Hi,
While working with you on your other thread I was also working on this one, so to add a custom ID to the blog element in the 1/4 column on your homepage I enabled the developer ID field on your elements at Enfold Theme Options > Layout Builder > Builder Options For Developers > ID attribute input field
then in the blog element on your homepage I added the ID “sidebar_blog” so it could be targeted without effecting other elements elsewhere:
now if you add this code to the end of your functions.php file in Appearance > Editor the heading will be changed:function custom_sidebar_blog_script(){ ?> <script> (function($) { $(document).ready(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); }); } replaceElementTag('#sidebar_blog .post-title.entry-title ', '<h4></h4>'); }); }(jQuery)); </script> <?php } add_action('wp_footer', 'custom_sidebar_blog_script');
Please note that the heading is H4 in the script but you can change it to whatever you want, I choose H4 because you had manually changed the php file to H5 and I wanted it to show a difference.
Now going forward any blog element that you add the ID “sidebar_blog” to will be changed.
Best regards,
MikeJanuary 6, 2020 at 10:33 am #1170647Hi Mike,
thank you very much. This works.
best
MarcelJanuary 6, 2020 at 11:36 am #1170663Hi,
Glad we were able to help, we will close this now. Thank you for using Enfold.For your information, you can take a look at Enfold documentation here
For any other questions or issues, feel free to start new threads in the Enfold forum and we will gladly try to help you :)Best regards,
Mike -
AuthorPosts
- The topic ‘change standard h2 heading at post to h4’ is closed to new replies.