• Resolved mishagos

    (@mishagos)


    Hi,

    Loving this theme. However, having trouble figuring out where to configure the posts_per_page. Default seems to be 10. I’d like to set it to 9.

    Could not find where the WP_Query is originally called to set the default. Can you point me in the right direction?

    I’ve scoured Bsb4Design and can’t find anywhere to plug that in.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael

    (@alchymyth)

    normally, the ‘posts per page’ is set from within the dashboard via ‘Settings – Reading – Blog pages show at most [ ] posts’

    Thread Starter mishagos

    (@mishagos)

    Thanks @alchymyth

    Theme Author vee

    (@okvee)

    Hi,

    Sorry for lag of answer.

    To use posts_per_page in case that you modify this theme.
    Add this code in functions.php

    
    /**
     * Override posts per page.
     * @param \WP_Query $query
    */
    function bootstrapBasicMyItemsPerPage($query)
    {
        $query->set('posts_per_page', 5);// I set this to 5 for easily to count as an example, use your own number.
    }// bootstrapBasicMyItemsPerPage
    add_action('pre_get_posts', 'bootstrapBasicMyItemsPerPage');
    

    In case that you want to use child theme and you want to modify posts per page, add priority 11 in add_action() function.
    Example:

    
    add_action('pre_get_posts', 'bootstrapBasicMyItemsPerPage', 11);
    

    I hope it help you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to set posts_per_page in this theme?’ is closed to new replies.