Automatically dynamically preview posts of the correct type in archive template query in the site editor

Description:

We have a site with multiple custom post types (created in ACF) in addition to the default post type. Resources, Events, etc.

We have added Archive templates and Single templates for each post type.

In the Archives, we have used a Query block that inherits the query from the url.

When viewing the page in the front-end, it works perfectly and displays the correct posts. In the editor, it loads the default posts, not the custom ones.

For additional information, we used the + default templates for each custom type and appropriate visibility conditions in the Cwicly Themer > Templates.

Step-by-step reproduction instructions:

Please write the steps needed to reproduce the bug.

  1. Create a custom post type (e.g. Resources)
  2. Add some standard posts
  3. Add some custom posts (Resources)
  4. Open Cwicly Themer > Templates
  5. Add a default template for the post type
  6. Add a default template for the custom post type (Resource Archive template)
  7. Edit the Resource Archive template
  8. Add a Query block with inherit from URL enabled with a nested Query Template block
  9. Add some blocks with dynamic content from the custom posts
  10. Note that the query is loading standard post data in the editor preview, not the correct custom posts.
  11. View the archive in the frontend
  12. Note that it correctly displays the custom posts

Environment info

  • WordPress version: 6.2.2
  • Cwicly Plugin version: 1.2.9.9

A temporary workaround until this is resolved, is:

  1. Switch off “Inherit query from URL”
  2. Open the query editor and set the post type to the correct custom post type
  3. Immediately switch “Inherit query from URL” back on again

It still retains the custom post type you set and displays the correct posts in the Query Template.

Hi @StrangeTech,

Thank you for bringing this to our attention!

I don’t think this could be considered a bug, as we haven’t implemented the required logic for an inherited query to show posts from the ‘correct’ post type in the backend.

Nevertheless, your point is valid and we can see a need for this.

Moving this to planned feature requests.

Thank you @Araminta.

1 Like