• Resolved neotechnomad

    (@neotechnomad)


    The plugin works fine except for one problem…

    The number of posts set for the main page and any archive or category archive must be the same, as the plugin works off of the “Blog pages show at most” setting on the “Readings Settings” of the sites main settings.

    I wanted one post to show on the main page (…and then continue to load another post, and so on) and six to show on the archive or category archive pages, but this cannot happen because for the plugin to work properly, the “Blog pages show at most” setting has to be set for the plugin – in my case, “one”.
    Now the archive or category archive pages only show one post.

    This means whatever number I set for the plugin is what the archive or category archive pages are going to be also.

    I even renamed the entire navigation on the main page so that it would be unique, but this did not work. The plugin still uses the “Readings Settings” number of posts.

    Is there no way to seperate the plugins number of posts to something different than the sites main “Readings Settings”?

    https://www.ads-software.com/plugins/infinite-scroll-and-load-more-ajax-pagination/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter neotechnomad

    (@neotechnomad)

    So, after some more searching, I found this function in the WP Codex (https://codex.www.ads-software.com/Pagination#Removing_query_posts_from_the_main_loop):

    ‘function my_post_queries( $query ) {
    // do not alter the query on wp-admin pages and only alter it if it’s the main query
    if (!is_admin() && $query->is_main_query()){

    // alter the query for the home and category pages

    if(is_home()){
    $query->set(‘posts_per_page’, 1);
    $query->set( ‘cat’, ‘1’ );
    }

    if(is_category()){
    $query->set(‘posts_per_page’, 6);
    }

    }
    }
    add_action( ‘pre_get_posts’, ‘my_post_queries’ );’

    Added to the functions.php file, the “add more posts” of the plugin still functions on all the navs, but it allows one to set parameters for the home page and different categories, if need be.

    Setting something similar to this into the parameters of the plugin may be a possible suggestion for an upgrade.

    All in all, love the plugin.

    Plugin Author pixellanguage

    (@pixellanguage)

    Yeah you are right, I am working on new addition to this plugin and will try to incorporate this option too ?? thanks for your suggestion.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Different amount of posts for main page and archive pages’ is closed to new replies.