Show more posts in category, archive, etc..

This topic contains 6 replies, has 4 voices, and was last updated by  Naveen Giri 4 years, 8 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #513525

    byalik
    Lifetime Member
    Post count: 78

    How can I show more posts on these pages without changing the default wordpress data in posts so my regular blog is not affected? I only want to increase the number of posts to show in wpgeodirectory.

    Thank you

    #513530

    Kor
    Moderator
    Post count: 16516

    Hi byalik,

    Thanks for your post. Try using the “GD > Listing” shortcode as explained here and increase the “Post to show” value https://wpgeodirectory.com/docs-v2/design/gd-listings/

    #513533

    byalik
    Lifetime Member
    Post count: 78

    Those instructions say not to use it on the archive pages or search pages

    #513554

    Alex Rollin
    Moderator
    Post count: 27815

    That isn’t currently possible without a customization.

    Let me check with the developers if there is a workaround.

    #514012

    Naveen Giri
    Moderator
    Post count: 1559

    Hi byalik,

    you can try this code snippet.

    
    
    
    function my_gd_change_posts_per_page( $query ) {
    	if ( is_admin() || ! $query->is_main_query() ) {
    		return;
    	}
    
    	if ( is_post_type_archive( 'gd_place' ) || is_search() ) {
    		$query->set( 'posts_per_page', 30 );
    	}
    }
    add_filter( 'pre_get_posts', 'my_gd_change_posts_per_page' );
    
    #514016

    byalik
    Lifetime Member
    Post count: 78

    Thank you I’ll try it. But what file do I add this to?

    #514017

    Naveen Giri
    Moderator
    Post count: 1559

    you can use https://wordpress.org/plugins/code-snippets/
    plugin. if you dont have any custom theme or custom plugin.

Viewing 7 posts - 1 through 7 (of 7 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket