Site logo

[Resolved] Number of posts to be displayed on the blog page

Home Forums Support [Resolved] Number of posts to be displayed on the blog page

Home Forums Support Number of posts to be displayed on the blog page

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #2593265
    Irfan

    Hi,

    I have a dedicated blog section on my site. In order to customize the appearance of excerpts etc I have setup an element with
    – type “Block – Content Template”
    – Location : Blog and All Archives
    and I am using a query loop on this element type
    However on the blog page the query duplication/repeats itself many times like loop within a loop. The same blog listings are shown many times.
    Having spent considerable time searching for the problem, I have found out that the duplication amount is the same number as provided in Settings > Reading > Blog Pages show at most ____ posts.
    For example if I set the above number to 3 posts and in the elements section if I set the block propery “Posts per page” to 3, this is what shows on the blog page

    Blog Page Title
    Post 1 Title/Excerpt – Post 2 Title/Excerpt – Post 3 Title/Excerpt – Post 4 Title/Excerpt

    Blog Page Title
    Post 1 Title/Excerpt – Post 2 Title/Excerpt – Post 3 Title/Excerpt – Post 4 Title/Excerpt

    Blog Page Title
    Post 1 Title/Excerpt – Post 2 Title/Excerpt – Post 3 Title/Excerpt – Post 4 Title/Excerpt

    If I set the number to 1 under Settings > Reading > Blog Pages show at most ____ posts. section all is fine and there’s no repetition.
    Is this supposed to be the right way or am I missing something ?
    Thanks in advance
    Irfan

    #2593292
    David
    Staff
    Customer Support

    Hi there,

    the Content Template block element replaces the template that is used to display each post.

    if you want rebuild the index / archives with the Query Loop then use the Loop Template instead.

    #2595754
    Irfan

    Hi David,

    Thanks I corrected my template. However once I changed the template the pagination links at the bottom of the posts disappeared, how can I restore them ?

    #2595764
    Fernando
    Customer Support

    Hi Irfan,

    Did you use a Loop Template? If yes, you can add pagination as instructed here: https://generatepress.com/forums/topic/query-loops-pagination-for-categories/#post-2414210

    #2595794
    Irfan

    Hi Fernando,

    How dumb of me yes I added pagination from the toolbar and I have the pagination back
    Thanks for the fast response!

    #2595809
    Fernando
    Customer Support

    You’re welcome, Irfan!

    #2595818
    Irfan

    Now I have the pagination but how can I change the label in the pagination ? For previous/next labels etc.
    And the URL of the pages are not SEO friendly like “?query-a14f3a8e-page=3”. How can I make it like /page/3

    I have the “Post name” in permalink structure in the settings of WP

    #2595837
    Fernando
    Customer Support

    To clarify, have you set the Query Loop to “Inherit Loop from template”? Reference: https://docs.generatepress.com/article/block-element-loop-template/

    #2595894
    Irfan

    Hi Fernando,

    Thanks for your patience.
    When I check it I see that this setting was off. I turned it on and the slug is now /page/2 …etc
    However when I click to next page and the URL is /page/2 then I get “page not found” from WordPress web page

    And when I set the Query Loop to “Inherit Loop from template” how can I set number of posts per page and add custom parameters. Before this setting was off I was able to customize it.

    Under this switch there is the following explanation: “Toggle to use the global query context that is set with the current template, such as an archive or search.”

    If I turn it on how can customize the “global query context” ? Under which menu item can I access it ? The template I used is “Pixel” from GeneratePress : https://gpsites.co/pixel/

    #2596106
    David
    Staff
    Customer Support

    If you use Inherit Loop from template that is all you can do. You can’t add other parameters to the block as those would conflict.
    Instead you change the main query:
    For example the number of posts that are displayed can be changed in the Settings > Reading -> Blog pages show at most

    What other changes are you wanting to make to this loop ?

    #2596182
    Irfan

    I was thinking of excluding some categories but I can try to live without it.
    However as I have stated in my previous post the 2nd page shows “page not found” for the URL …./page/2
    I would appreciate if you can point me in the right direction for this problem

    #2596373
    David
    Staff
    Customer Support

    Can you make sure that there are no parameters set on the Query Loop block and then re-enable the Inherit Query from Template

    Then go to Dashboard > Settings > Permalinks and click save changes to regenerate the permalinks.

    If you want to exclude categories or other changes let me know

    #2596608
    Irfan

    Thanks a lot, it worked 🙂

    #2597690
    David
    Staff
    Customer Support

    Glad to hear that!

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