Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1307907

    Hi Kriesi,

    could you kindly help in finding out how to change the font of the titles of the related posts on a page? SEO is complaining that there are too many h3 tags so I would prefer to style those titles manually without a headline tag.

    Possible?

    Best regards
    Meike

    #1308042

    Hey AlpseeDesign,

    Thank you for the inquiry.

    Would you mind providing a link to a page containing the related posts section? By default, the theme is not using h3 tags for the titles of the related posts, so it might be generated by a plugin or a custom script. Did you modify the includes > related-posts.php file?

    Best regards,
    Ismael

    #1308075

    Hey Ismael,

    Thanks for the quick reply! Sure, here’s a link:

    Have to admit I am not sure if I modified this myself because I have been workin gon this site fo over a year and my memory is failing me. ;)

    It would also be great to know how to remove the current post from the related posts section.

    Thank you!

    Have a nice day!

    #1308601

    Hi,
    Thank you for your patience and the link to your page, I believe you mean the section at the bottom of the page diese Ausflüge könnten Dich auch interessieren:
    this is a posts slider and not a related posts element, to have it not show the current post try setting the offset to Do not allow duplicate posts on the entire page (set offset automatically)
    2021-07-03_008.jpg
    To change the h3 of the titles, it would be best to first add a custom class to the element so the script doesn’t effect other elements, perhaps related-posts-slider
    2021-07-03_009.jpg
    Then try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_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('.related-posts-slider h3.slide-entry-title', '<p></p>');
      });
    }(jQuery));
    </script>
        <?php
    }
    add_action('wp_footer', 'custom_script');

    it will replace the h3 with p

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.