How To Show Related Posts in GeneratePress WordPress Theme 2022 | GeneratePress Theme Customization

Are You using a GeneratePress premium theme and looking to show related posts in the GeneratePress premium theme?

If yes, then you are in the right place.

But before that let me tell you that you can’t show related posts in the GeneratePress theme without using a plugin. You have to use a plugin to show related posts in the GeneratePress theme.

You need to follow these simple steps if you want to display related posts in the GeneratePress theme.

  • Using related posts plugin available on WordPress directory.
  • Using custom code in functions.php
  • With Code + Plugin Techniques.

You can follow the steps mentioned in the video to know the best method to display related posts in the GeneratePress premium theme.

You need to paste the following code in the hook element:

<div class="wpsp-related-posts1 grid-container"> <h2>Related Posts</h2>
<?php
if ( is_single() ) { $cats = get_the_category(); $cat = $cats[0];
} else { $cat = get_category( get_query_var( 'cat' ) );
} $cat_slug = $cat->slug;
$list = get_page_by_title( 'related', 'OBJECT', 'wp_show_posts' );
wpsp_display( $list->ID, 'tax_term="' . $cat_slug . '"' );
?>
</div>

Paste the following code in the additional CSS to styling related posts:

.wpsp-related-posts1 { background-color: #fff; padding: 24px 20px 10px 20px; margin-top: 10px; -webkit-box-sizing: border-box; box-sizing: border-box; box-shadow: rgba(23, 43, 99, .14) 0 7px 28px !important;
}

I hope this post helps you to show related posts in the GeneratePress theme. If you have any queries then please let me know in the comments section.

Source: https://askblogging.com/show-related-posts-in-generatepress/



You might also like this video