Adding pre_get_posts
is too late if subscribed in a page template and your template is empty so that’s the reason nothing it showing.
Move your pre_get_posts
out to your functions.php
so it has a chance to run. Also consider using template_include
and specifying using book template another way that you can check for in that function.
Related Posts:
- Templates & CSS – Proper Programming Practice?
- index.php template is used instead of blog page
- How to apply a custom template for posts by default?
- Is there a way to set different post templates for parent posts and child posts in the same post type?
- Single-page.php template file name not shown
- Organize template parts and page templates in folders in regards of template hierarchy
- How can I make custom page templates work on child theme?
- Page Templates Used in Custom Post Type
- Page editor missing Templates drop down
- How to edit contents of dynamic_sidebar()?
- Is it possible to manipulate the list of page templates?
- Loading partial templates with AJAX/PJAX
- I put my blog on a subpage, how do I get page title?
- How to hide/redirect the author page
- Need to give custom page template for each language in WPML
- page_template toggle between 2 templates + 2 permalinks for same post
- Create Page that uses specific template
- Post formats template
- Hide Front-End Admin Bar Including 32 px Spacing
- What is a good way to present templated content in WordPress?
- Adding variable to get_template_part
- Load template file without a post type
- How to move style from template file to section?
- Subpage template
- Unable to include a template
- How to create a wordpress template without using any page
- Advanced Custom Fields – display when specific template used?
- What should I put on my index.php?
- For custom templates, is it better to use `template_include` or `type_template`?
- When a link doesn’t exist, how to tell WordPress what to do? (404 Error Page)
- How do I find the directory of a page template?
- Missing ‘Page Attributes’
- how to use custom page template in a page?
- the_excerpt producing empty output
- Conditionally display different images before the content in a page template
- Change wp-signup.php Page Template
- How to remove the Template drop down, but keep Parent and Order
- Templates have disappeared from drop down lists
- One of my pages uses the archive.php template only. Why?
- Getting pages filtered by template assigned
- Get link to a specific template file [closed]
- Default Template Selected After Changes in Elementor [closed]
- Having trouble with Template hierarchy. I Need to create a set of pages that drill down from states to specific locations
- Use same page template for parent and child pages in a theme
- displaying category and subject posts
- How to duplicate a page template but make minor changes to the header?
- Adding Query to Custom Page Template
- All top-level pages are using index.php as template
- Custom templates vs page-slug
- get_file_data to read data for Custom Template File?
- Page attributes missing
- Selected template is not respected for home page in WordPress
- Understanding the Template hierarchy
- How does WordPress choose archive type template?
- wp_enqueue_style and different styles for blog template
- Use one template only for custom post type archives?
- Page template option missing
- How do I get the page template name chosen?
- How can I add text to a specific ‘Edit Page’?
- get_header(), get_footer() from plugin template
- What template is used for viewing Media Library Files?
- get_month_link uses what wordpress template?
- Page template for a site from network
- Force WordPress to NOT display the manual excerpt
- Differentiation between index.php and page.php
- Undefined get_header function
- Can a link in WordPress contain a query string that is picked up as $_POST
- Can I assign a Folder for Post Formats, without it affecting WordPress’ fallback/hierarchical system?
- Hard Coding Components on a Client Specific Websites
- Assigning custom page templates to a static blog page
- Will placing custom templates in sub directory break any native WordPress functionality
- Archive-custome_post.php template not working
- Blog page won’t show Blog template
- Help Understanding Template Hierarchy
- templates with page teasers Or Featured Items
- Random home page at each refresh between array of page IDs
- User role templates
- Assign template to custom page type?
- Search button click sends to single-custom_post_type instead staying at the same page
- BuddyPress : how can I call the template WordPress would have chosen (template hierarchy)?
- Display a custom 404 page without a redirect
- Change Page Template Based on URL Rewrite in WordPress
- Nested Page Template not showing in page attributes
- Which template(s) to override to use a different sidebar for blog, single posts, categories, blog archive?
- Creating custom post-listing templates in twentyseventeen child theme
- Single Post Templates Doubt
- Custom Homepage As Single Page or Custom Post Type?
- When to use content-pagename.php?
- Submit form to another template (ugly url)
- custom template – override plugin template in child theme – issue with scripts
- Show a custom template, no matter the page being viewed, if the user is not logged in
- Is this the best way to complete disable category archive pages?
- Passing query variables to a custom page template
- Is there a way to share a template/markup with the JSON API so that it doesn’t need to be declared both in PHP and in JS?
- How to install a wordpress website template on an existing website?
- Custom Archive with Content for Custom Post Type
- Page.php vs Single.php
- My homepage’s width has reduced and I can´t fix it [closed]
- html blog template to wordpress template
- Unload templates; disable parent Template Parts using only “theme.json”