There is a filter called theme_page_templates
which you can use to force the use of a certain template under certain circumstances. Like this:
add_filter ('theme_page_templates', 'wpse263827_filter_theme_page_templates', 20, 3 );
wpse263827_filter_theme_page_templates ($page_templates, $this, $post) {
if (condition based on $post) $page_templates="path-to-template.php";
return $page_templates;
}
So, you can place the template file wherever you want and assign it when the page is in that certain category. No need to touch the url structure.
Related Posts:
- Why are theme templates organized as multiple point of entry PHP files instead of reusing your theme’s index.php?
- Replace single_template filter with what for default posts?
- What’s the difference between home.php and index.php?
- Custom single template for a specific category
- How to insert a logo in the header?
- How to remove search bar from a wordpress theme? [closed]
- How to remove the Theme Customization Button from the dashboard and themes options page?
- What filters are applied to the_content function?
- Change admin bar to default:off
- How to modify an image block in Gutenberg WordPress 5?
- How to move page templates to custom folder?
- Page template in two level deep folder
- Edit srcset and sizes attributes in Gutenberg image, cover and gallery – blocks
- Is it possible to manipulate the list of page templates?
- Template for individual post designs
- wp_get_attachment_image_attributes not working for me
- Different wordpress 404 template for different post type [duplicate]
- How does WordPress decide what template to use as frontpage
- How can I get wp_head() as a string instead of echoing it?
- Display a different theme for not logged-in users
- Why does my short code get executed before other content?
- Run shortcode before filters
- Retrieve the template directory URI via global or get_template_directory_uri() every time?
- How can I see what template parts are being called for rendering the viewable page?
- Add class to before_widget for all widgets with a dropdown and a counter
- Add a preview to a WordPress Control Panel
- How to Auto Approve Comments on a Specific Page?
- Add a #hash to the links in my custom menu
- Problems with Layout inherit in theme.json
- Get password when user registers and save it sha1 into database
- How to Handle CSS for Multiple Header header.php Files?
- How to load different CSS in different Header?
- Static Front Page problem
- Passing variable in hooks and filter
- Returning Variables back into a template
- Can not Remove Archives and Meta from Sidebar
- How to override BuddyPress 3.0 bp-nouveau theme files?
- Setting hero/splash section as a blog post
- WordPress nav_menu_css_class theme filter is not being called
- Where is the correct place(s) in twentysixteen’s header.php to add a Google webfont?
- customizing the_password_form filter
- How to retrieve an image from a post and display it before excerpt of a post? [duplicate]
- Any tag pagination page (except the 1st page) loads index.php template instead of tag.php
- How do I update WooCommerce template files in my theme? [closed]
- WordPress Genesis Child Theme Filter divs
- Change file name from wp_generate_attachment_metadata
- New template, where to place CSS?
- Check if password protected post is visible
- get_query_var() and permalinks
- What is the best way to handle multiple calls to get_template_directory_uri() and similar functions?
- Toggle Sidebar Display
- Add theme templates for child categories into the template hierarchy
- Move theme templates to subfolder without losing page associations
- Where can I access my custom page template?
- Theme development question regarding layouts
- How can i convert the figma design into wordpress [closed]
- WordPress Theme Development: How to redirect templates the right way?
- Disable front-page.php template
- How do I create a custom partial / template?
- Change the template of multiple multisite pages at the same time
- Simple way to get two language WP site
- Load child template based on parent
- Highlight “Show all” item in wp_list_categories
- create-guten-block in wordpress theme?
- When trying to override plugin’s function by theme, my filter executes two times, I want it to run only a single time
- Override template file i subfolders
- Single Page theme [closed]
- Menu item added in wp_nav_menu_items filter is never highlighted
- Single page site with history.js
- Should I use add_filter for functions in function.php of the theme?
- Do i need to keep all the default WP templates files in a theme?
- Pass variable to hook. Its possible?
- How can I detect hierarchal relationships beyond children (grandchild, great-grandchild, etc)?
- how to display search term in the template full site editor
- Catagories to the list of the titles in that catagory to the content of the post [closed]
- Sort wp_query by sum of two meta fields
- How to override p2 breathe theme plugin in content template file?
- Move default page templates to sub directory
- WordPress taxonomy and archive custom class
- What can I use for small text when converting to WordPress?
- Filter categories used with Custom Structure Permalink
- Where to place template files?
- Is there any tool to find lines of codes responsible to generate front-end HTML elements?
- How do I get the trackback count of a post in wordpress without writing an SQL query?
- How to wrap all titles generated by Gutenberg “Heading” block with tag
- Load sidebar template just once to prevent multiple animations
- Need help with adding templates (archives and sitemap) to WordPress child theme
- Template for landing pages
- How to rotate every letter in a title
- How to seperate static phrases from template files in custom theme?
- Broken theme, template is missing
- How to disable thumbnail filter for a specific template part or image size?
- How to add menù section to my WordPress template?
- CSS class on last post in loop ( custom query )
- Post and page content not displaying in search results
- How to change footer credit text in Twenty Twenty One theme with a hook?
- Why still output /wp-content/themes/twentynineteen?
- Use a filter on menu items that have children
- Modify available templates (in dropdown)
- How to add custom meta box when you have a custom page template file