• Resolved xhide00

    (@xhide00)


    right now the number of list in the archive listing follows the WordPress’ “Blog pages show at most” setting in the Reading setting.

    However, the thing is I’m currently using this setting to show 3 of the latest posts in the Blog side of the web site. And I need to how 6 latest posts in the WP-Listing’ archive page.

    is there a way to bypass this setting and display it’s own number of list for WP-Listing’s archive page?

    the code in the archive page looks like this:

    https://www.ads-software.com/plugins/wp-listings/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author agentevolution

    (@agentevolution)

    There is a setting in the WP Listing settings that controls the archive pages. Listings > Settings > Default number of posts.

    Thread Starter xhide00

    (@xhide00)

    Yes, I did that but that setting doesn’t do anything
    and still uses WP’s setting.

    is there something that might have caused this to not work?

    Plugin Author agentevolution

    (@agentevolution)

    No. Is this the main archive page (i.e. youdomain.com/listings/) ? Or is it a taxonomy archive page? If it’s a taxonomy archive, that setting would not apply but you can add custom function to your theme to apply it there as well.

    Thread Starter xhide00

    (@xhide00)

    o I see.
    yes, this is a custom taxonomy archive page.
    How & What kind of code do I add to the functions.php?

    please let me know.
    thank you!

    Plugin Author agentevolution

    (@agentevolution)

    This is a modified version of the same function in the plugin. Add to your theme’s functions.php:

    function wp_listings_taxonomy_post_number( $query ) {
    
    	if ( !is_tax() || is_admin() ) {
    		return;
    	}
    
    	$options = get_option('plugin_wp_listings_settings');
    
    	$archive_posts_num = $options['wp_listings_archive_posts_num'];
    
    	if ( empty($archive_posts_num) ) {
    		$archive_posts_num = '9';
    	}
    
    	$query->query_vars['posts_per_page'] = $archive_posts_num;
    
    }
    add_action( 'pre_get_posts', 'wp_listings_taxonomy_post_number' );
    Thread Starter xhide00

    (@xhide00)

    This Works!
    Thank you So much!!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Archive Page to bypass "Blog pages show at most" setting’ is closed to new replies.