• Haldan

    (@hblecher)


    Hi to anyone who can help,

    I’m having trouble with the “inherit query from template” toggle in my home page’s post grid query loop. I was previously not using this option because I wanted to customize the number of posts that would appear in the query using WYSIWYG editor, and filter by category. But doing that prevented the search and archive functions from working, so I’ve toggled it on now.

    But now I can’t seem to change the number of posts that appear in the query by editing the index template. I’ve changed the number that follows the “perPage” field to 21, but it continues to only show 10 posts on my homepage. I thought this might be down to cacheing, but I’ve cleared the cache multiple times, and the issue persists. One weird quirk though is that within the site editor view, it’s showing all 21 posts, but when I load the site itself, it’s still only loading 10 posts. Gutenberg version is updated, and I can’t think of anything else to try to fix this.

    Any help would be very appreciated! Thanks

    • This topic was modified 3 years ago by Haldan.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter Haldan

    (@hblecher)

    Update: well, I feel a little dumb. After hours of trying to google what the global query context refers to, and digging through the Gutenberg and Tove code, it turns out “inherit query from template” is a misnomer. It doesn’t inherit the query settings from the currently used template (which makes sense, since the query loop block likely lives on the template page itself anyway). If you have this toggle enabled, worpress will ignore any other settings you hard code in the template. What this actually refers to is the global WordPress “Reading” settings in the dashboard. It’s been so long since I bothered to think about those settings, I had forgotten all about them. On this settings screen, it was a simple task to just change the number of posts shown on the home page from 10 to the desired number 21. Easy peasy.

    It seems like a real oversight for Gutenberg to use this verbiage, and I’m comforted to know I’m not the only person who has totally misunderstood this. Hopefully this is corrected in future Gutenberg updates, and as importantly, I hope that Gutenberg folks figure out a way to either (a) keep the toggle enabled but offer a way to limit posts in the query by category, etc., or (b) find a way to get search and archive to work within the custom query loop. (or both)

Viewing 1 replies (of 1 total)
  • The topic ‘Inherit query from template issues’ is closed to new replies.