- This topic has 8 replies, 4 voices, and was last updated 4 years, 10 months ago by
David.
-
AuthorPosts
-
June 8, 2020 at 4:43 am #1318957
Sagar
Hi there,
I want to show related posts in the sidebar and after the content. I don’t want to use any plugin because they slow down the websites like Yarrp and others.
Is there any code or something like in other themes. I request Tom to create a related post plugin, especially for GP users.
Please help me with some code.
Thank you.
June 8, 2020 at 7:22 am #1319157David
StaffCustomer SupportHi there,
Related Posts is something that requires a plugin.
You may want to research plugins that display posts related just by Categories for example. They will not have the performance impact on your server like YARRP does.June 8, 2020 at 8:06 am #1319344Sagar
Hey,
I have seen one of the methods of creating related posts through your plugin WP show posts. Use this plugin and activate the Element module.
Add this code in the hook in order to show the related posts by Category:
<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 . ‘”‘ );
?>——-
I found this in this blog: https://www.wplogout.com/display-related-posts-in-generatepress-theme/Could you please check this code and let me know so that I can add it on my website without installing any other related post plugin except yours WP show posts.
June 8, 2020 at 8:41 am #1319398gabrielvb1100
I was trying the same thing as you, and I ended up using this code
https://www.hongkiat.com/blog/wordpress-related-posts-without-plugins/
but i prefer to use WP SHOW POSTS in an elementJune 8, 2020 at 8:59 am #1319457David
StaffCustomer SupportThis blog post from the Merch site in the GP library explains how and where to add the code:
May 26, 2021 at 1:42 am #1798448Jose
Following https://gpsites.co/merch/the-single-post/ I get an error at home page.
The home page appears as a tablet.
The related posts element is appearing on home with the message ‘There has been a critical error on this website’GenerateBlocks 1.3.3
GenerateBlocks Pro 1.0.3
GP Premium 2.0.2
WP Show Posts 1.1.3
WordPress 5.7.2May 26, 2021 at 5:23 am #1798690David
StaffCustomer SupportHi there,
theres a better method of using WP Show Posts to display posts within the same category – see here:
https://generatepress.com/forums/topic/related-popular-posts-widget/#post-1785158
May 26, 2021 at 7:06 am #1799054Jose
Great!!
It’s working nowMay 26, 2021 at 11:22 am #1799342David
StaffCustomer SupportGlad to hear that
-
AuthorPosts
- You must be logged in to reply to this topic.