as a solution, you can fully automate the selection of a template for a group of pages using slug names:
add_filter('request', function( $vars ) {
$slug = explode("https://wordpress.stackexchange.com/", explode('?', $_SERVER['REQUEST_URI'])[0]);
array_pop ($slug);
$temp_base = "...first_part_template_name...";
$temp_slug = array_pop ($slug);
if (file_exists(get_template_directory()."https://wordpress.stackexchange.com/".$template.'-'.$temp_cat.'.php')) {
get_template_part( $temp_base, $temp_slug );
}
}
Related Posts:
- How to add a new product type on woocommerce product types? [closed]
- Updating WordPress overwriting customization tweaks – strategies?
- How to customize the default HTML for WordPress Attachments
- wp_trim_words() does not trim the_content() in WordPress
- page_template toggle between 2 templates + 2 permalinks for same post
- Make page template that is just an “include” of another?
- Custom php file in wordpress
- Selecting An image from the Media LIbrary on the frontend
- WordPress Template not affecting the working, keeps defaulting to the index.php template
- Recommend an open source, template driven website builder UI that produces a working WordPress site [closed]
- For custom templates, is it better to use `template_include` or `type_template`?
- Create default_content layout template based on post id
- Remove template drop down for certain pages
- How do I add a new template to my site
- How to customize core admin pages within a theme?
- How can I make site-wide content editable, for example footer content
- Query post for ‘selected category’ in archive.php
- Showcase elementor templates
- How to get custom page template being edited in gutenberg editor
- Make custom page look exactly as homepage
- Best practice – pages – ACF or inline coding
- Set Title from Custom Template
- Page attributes missing
- How to hook up search results page to a back-end page?
- How To Load an HTML File As A WordPress Page (With No 301/No Redirect)
- Is there a way to by-pass the pagination function on one custom template?
- Editing a post template
- WordPress archive index page
- How to add custom ‘layout’ buttons to wordpress editor?
- How to create custom layouts and static pages in themes for clients
- Custom Content Page
- Create a Page template selector page
- Creating custom page template
- Force WordPress to load a specific template
- Dynamic Sidebars based on page name
- Translate custom template with WPML
- How To make Custom page of every Category
- why won’t my custom css load with the enqueue method or any other method?
- Conflict between Yoast SEO and my custom theme
- Custom post-type working except for Selecting page-parent
- How to add a template – so that i can choose a different menu for some pages
- How can I delete the word `Category:` from page titles? [duplicate]
- How can I add category variable inside posts?
- Why does a custom php code inside a custom template not get executed?
- wordpress custom posts page not showing
- How do I target this page specifically?
- How to use a custom playlist template:
- WordPress function with attribute pass to template
- Still desperate about multiple TinyMCEs in widgets – is there any good solution to this yet?
- Displaying Child Page’s Information
- Getting a jQuery library to work in WordPress & Avada
- Use another theme template in my theme
- Redirect Every Instance of The Author Template Pages to Custom Author Pages
- Allow arbitrary text after page URL
- Taxonomy template by post type
- Best way to create a page outside of the pages list
- Template setting is not saving in wordpress
- Make Terms Under Custom Taxonomy Use Specific Single.php Template
- Custom single page based on which custom page template is selected
- Single page template
- Adding css and js to a blank page created with custom template
- Modifying a local template
- How to apply styles to the custom page template
- Create a page for each database table entries
- Custom maintenance page
- Custom protected password page with ACF
- Customize in category page
- Custom Dashboard Home Screen Options
- How to get WordPress to accept the tag in articles (or other alternatives)
- Apply custom category template to subcategories
- How do I change the default admin color scheme in MP6
- How can a single line in a blog post take down my server?
- Adding a Table to the wordpress database
- how can I change the background color of all posts on my server?
- Turn off redirect to canonical domain (or host website on any hostname)
- Custom title, Bones theme
- How to change the category url jusy show /category/%category_id% in wordpress?
- How can I display a PHP foreach loop’s answers by AJAX
- Use of Templates in a Plugin
- Child Theme with multiple css files
- Why the css in twenteenfourteen-child theme take no effect?
- add custom content to appearance/widgets screen
- css media query question [closed]
- How to create a page /1 using ?
- theme customizer – can a single option pass multiple values?
- Separate header for static home page and posts page
- Pagination with custom field
- How to retain visual breadcrumbs w/ tricky URL structure? Custom post template?
- Adding overlay search to wordpress using add action/filter
- How can I create a Custom Page? (not a page template!!)
- Adding a drop-down (select tag) option under Menu Settings in WordPress Admin
- How to have different background image based on post category
- Custom stylesheet not loading
- Custom Admin Section
- issue with saving custom metaboxes fields
- DOM reference to TinyMCE editor element (button)
- Possible to make a site like urban dictionary using WP?
- Change the functionality of wordpress users module in admin
- Two searchforms with different categories/posts per page
- Custom Search on media files PDF images pages posts