Tagged: h3, related posts, seo, tag, title
-
AuthorPosts
-
June 29, 2021 at 11:20 am #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
MeikeJune 30, 2021 at 7:49 am #1308042Hey 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,
IsmaelJune 30, 2021 at 11:32 am #1308075Hey 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!
July 3, 2021 at 9:57 pm #1308601Hi,
Thank you for your patience and the link to your page, I believe you mean the section at the bottom of the pagediese 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)
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, perhapsrelated-posts-slider
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 -
AuthorPosts
- You must be logged in to reply to this topic.