[Resolved] Homepage & Categories: 2 columns layout and featured article.

Home Forums Support [Resolved] Homepage & Categories: 2 columns layout and featured article.

Home Forums Support Homepage & Categories: 2 columns layout and featured article.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1976370
    Atty

    On the homepage and categories when I enter the “2 columns” and “first article in evidence” option, the last article excerpts shown is always odd, putting 10 articles visible.

    If I enter 11 (from generale options) it always remains odd when I continue reading the various pages of the category or starting from the homepage. How to solve? Thanks!

    #1976472
    Ying
    Staff
    Customer Support

    Hi Atty,

    Not sure I understand your question, do you mean when you choose 11 posts for the Blog pages show at most at settings > readings, the home page still show 10 articles most on each page?

    If so, can you set to 11 so we can have a look?

    #1976473
    Ying
    Staff
    Customer Support

    Hi Atty,

    Not sure I understand your question, do you mean when you choose 11 posts for the Blog pages show at most at settings > readings, the home page still show 10 articles most on each page?

    If so, can you set it to 11 so we can have a look?

    #1976710
    Atty

    Hi Ying, I’m sorry, I didn’t make myself clear.

    –> layout –> blog –> 2 columns and featured image selected.

    When you visit my homepage you can see 11 article summaries, including the one featured at the beginning. The same when you visit a category page.

    Now, I have selected a maximum of 10 articles for the homepage and for the categories but, with the image of the article highlighted, they become 11.

    How can I go about solving this problem? If I change the homepage / categories to 11 articles they have an even number, but if I continue on the next page, their number becomes odd, because there is not the first large image you find at the beginning (article-image in the foreground ).

    I hope I explained myself. Thank you!

    #1976845
    Ying
    Staff
    Customer Support

    Ah I see what you mean, that makes sense πŸ™‚

    Give this PHP snippet a try to set 11 posts for the 1st page, you can set it to 10 for the other pages at settings > reading.

    add_action( 'pre_get_posts', 'tu_change_posts_per_page', 1 );
    function tu_change_posts_per_page( &$query ) {
        if ( ! is_main_query() ) {
            return;
        }
    
        if ( ! $query->is_paged ) {
            $query->set( 'posts_per_page', 11 ); // First page 11 posts
        }
    }

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    #1976910
    Atty

    Hi Ying, it works perfectly. Thank you very much! πŸ™‚

    #1977094
    Ying
    Staff
    Customer Support

    Glad to hear that πŸ™‚

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.