Blog – related posts and sidebar recent posts heading tag

This topic has 9 replies, 3 voices, and was last updated 10 months ago ago by Enjin

  • Avatar: Enjin
    Enjin
    Participant
    June 22, 2023 at 11:20

    Hello,

    I have 2 questions about the blog…

    1- For the related posts section, I don’t know how I can change the related posts title tag (“Related posts”) which is in h3 by default… I couldn’t find it anywhere… I would like it to be a simple div tag.

    2- For the sidebar, I use the widget recent posts (8theme post widget) and the title is in h4 tag, I also need to change it… I found the file in “et-core-plugin” but I would like to make the change in my child theme so that I won’t loose the code in case of updates…for a simple div also

    Can you help me with these two questions ? I often have those demands on websites so I think it could be useful to other people as well 🙂

    Thank you !

    Please, contact administrator
    for this information.
    8 Answers
    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    June 22, 2023 at 18:05

    Hello, Enjin,

    We have developed a patch that will allow you to modify tiles using filters, and have installed it for you.
    Details can be found in the screenshot at https://prnt.sc/zzVyln9EI1Jy.

    You will need to add the following code to the functions.php file of your child theme.

    // Change related posts html tag for single post page
    add_filter('etheme_slider_title', 'custom_etheme_related_posts_title', 10, 2);
    function custom_etheme_related_posts_title($html, $title){
    	if (is_singular('post')) {
    		return '<div>' . $title . '</div>';
    	}
    	return $html;
    }
    
    // Change "8theme - Posts Widget" widget title tag
    add_filter('etheme_widget_args', 'custom_eetheme_widget_args', 10, 2);
    function custom_eetheme_widget_args($args){
    	if ($args['widget_name'] == '8theme - Posts Widget'){
    		$args['before_title'] = '<span class="widget-title">';
    		$args['after_title'] = '</span>';
    	}
    	return $args;
    }

    Best Regards,
    8Theme’s Team

    Avatar: Enjin
    Enjin
    Participant
    June 23, 2023 at 08:49

    Hello Andrew,

    Thank you a lot for the help, it’s working perfectly for the related posts.
    For the widget I don’t know why but it didn’t change anything, can you check please ?

    When you’ll update the theme and plugin, will this patch be erased ?

    Again, thank you for the help 😉

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    June 23, 2023 at 12:32

    Hello, Enjin,

    We can see that changes have been applied to the widget, details on the screenshot https://prnt.sc/1HAdVLnSlQX5.

    After the theme update, the patch will remain available for the theme version 9.1.7.
    For theme version 9.1.7+, it will be implemented in the update.

    Best Regards,
    8Theme’s Team

    Avatar: Enjin
    Enjin
    Participant
    June 23, 2023 at 13:01

    Ah I see I was having the issue with the h4 tag of the posts titles (class .media-heading)… We were not talking about the same thing…

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 23, 2023 at 16:13

    Hello, Enjin,

    Is there anything else we can do to assist you?

    Best Regards,
    8Theme’s Team

    Avatar: Enjin
    Enjin
    Participant
    June 23, 2023 at 16:19

    Hello,

    If you could help me to fix this tag issue, it would be great… I didn’t need to change the widget title, but the titles of the recent posts listed (they’re in h4 tag and not very good for SEO purposes to not be able to change it for a simple div… but I can’t edit it because it’s in the plugin folder).Here’s a screenshot : https://prnt.sc/trAPj0psadco

    I also have another “problem”. On my homepage I use a category masonry widget (elementor) to display a nice grid for product categories. I see there’s is no way to click on the image to go to the category, only on the small title below : https://prnt.sc/PwaJs0oqEcwF
    Is this on purpose ? My client asked me whether we could have the whole masonry item clickable for user experience…

    I’m sorry for all those questions, I hope you’ll be able to help me !

    Best regards

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    June 23, 2023 at 19:22

    Hello, Enjin,

    We have developed a patch that will allow you to modify tiles using filters, and have installed it for you.
    Details can be found in the screenshot at https://prnt.sc/sLHhIGwljYBF

    You will need to add the following code to the functions.php file of your child theme.

    add_filter('etheme_widget_post_title', 'custom_etheme_widget_post_title', 10, 3);
    
    function custom_etheme_widget_post_title($html, $title, $url){
    	return '<div class="media-heading"><a href="'.$url.'">' . $title . '</a></div>';
    }

    We have installed an additional plugin, WP Code, for adding the possibility of a link transition for the category masonry widget (Elementor).

    For more detailed information about it, please visit https://uk.wordpress.org/plugins/insert-headers-and-footers/.
    Due to this plugin, we added the following code to the theme footer:

    <script>
    jQuery(document).on('click', '.etheme-custom-masonry .et-masonry-item', function(e){
    	let href = jQuery(this).find('.item-name a').attr('href');
    	if (href) window.location = href; 
    });
    </script>

    If you do not wish to use the additional plugin, you can add the specified code to the child theme’s footer.php

    Best Regards,
    8Theme’s Team

    Please contact administrator
    for this information.
    Avatar: Enjin
    Enjin
    Participant
    June 26, 2023 at 08:24

    Hello,

    It is perfect, thank you a lot !

    I’ll keep these code snippets, we’ll probably use them for other websites with your theme. Great support, much appreciated !

    Best regards

  • Viewing 9 results - 1 through 9 (of 9 total)

The issue related to '‘Blog – related posts and sidebar recent posts heading tag’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.