Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #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 advance

    #1170102

    Hey megamazl,

    Could you please give us a link to your website, we need more context to be able to help you.

    Best regards,
    Victoria

    #1170121
    This reply has been marked as private.
    #1170139

    Hi megamazl,

    Could you please attach some screenshots of the issue?

    Best regards,
    Victoria

    #1170147

    Yes, 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 SEO

    Like i said, I changed it in another PHP file, but I think with an update, my changes will be overwritten.

    #1170153

    Hi megamazl,

    Thank you :)

    Best regards,
    Victoria

    #1170155

    I 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.

    #1170308

    Hi,
    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,
    Mike

    #1170442

    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?

    This is correct.
    Your function would help.

    thanks in advance

    #1170489

    Hi,
    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
    2020-01-05-115318
    then in the blog element on your homepage I added the ID “sidebar_blog” so it could be targeted without effecting other elements elsewhere:
    2020-01-05-102035
    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,
    Mike

    #1170647

    Hi Mike,

    thank you very much. This works.

    best
    Marcel

    #1170663

    Hi,
    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

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘change standard h2 heading at post to h4’ is closed to new replies.