How to change position Jetpack related post Module

It’s been a long time I use Jetpack plugin, but not all the jetpack module like the related post and social share module. Jetpack plug-in is a master of all plug-in, there are so many features like social share, related post, HTML, CSS and JavaScript minify and many more. You can see that there so many modules inbuilt in jetpack so you no need to download as another plug-in to add functionality into your WordPress website. And the main part of the jetpack module is you can on and off as you need but it has one drawback we can’t change the jetpack related post position. Recently I switched to a simpler WordPress theme because it takes less resource in our server and increases our website speed.

When I switched to the new WordPress theme, by default there are is no related posts and social sharing options on that theme. So we need to add related posts and social sharing via plugin or some other method. I already use the Jetpack plugin, so why not we use jetpack related post and social sharing. So we decide to use this jetpack module.

When I use that module it increases our website speed why? Because all the process to find the related post is not in our server but in the WordPress server and it improves the performance of the website. But the main drawback of the related post-module is we cannot reposition the module to use in the other position on our website.

 It stuck in one place only after the post end. But I want to change Jetpack related post position after the author’s bio. So we need some research and find that we can rearrange jetpack related post and sharing module through function.php and shortcode method. All the detailed you can find in jetpack official site. Steps to reposition jetpack related post module. As you can see in the image related post shows above the author bio. But we change the position in the next steps. So it will show after author bio.

jetpack related post

First, remove jetpack related post-module at the bottom of the post through function.php file. Insert the given code into your function.php file. It will remove the related post functionality in your theme.

 function jetpackme_remove_rp() {
    if ( class_exists( 'Jetpack_RelatedPosts' ) ) {
        $jprp     = Jetpack_RelatedPosts::init();
        $callback = array( $jprp, 'filter_add_target_to_dom' );
        remove_filter( 'the_content', $callback, 40 );
add_action( 'wp', 'jetpackme_remove_rp', 20 );

Second, enable related post-module through a shortcode. Insert the given shortcode into your post or anywhere in your theme to enable the jetpack related post module.

jetpack related post
<?php echo do_shortcode('[jetpack-related-posts]');?>

Here you can see related post move after author bio. With this shortcode you can show jetpack related post any were in you post and pages in your theme.

I've loved ❤ technology and always curious about new tech innovation. I've been a technology writer and passionate blogger for last 3 year and write How to guide to help people become a tech-savvy.

Leave a Comment