This might work:
add_filter('page_template', 'custom_page_template');
function custom_page_template($template){
// check your permalink here
if(get_query_var('pagename') === 'stories')
return locate_template(array('page2.php', 'page.php'));
return $template;
}
Related Posts:
- How to enable template page only for a post id page
- How Can I Create a Friendly Slug for a Dynamic Page?
- Define page template in wp_insert_post
- How to redirect to post if search results only returns one post
- Add custom template page programmatically
- Define custom Page Template without its own .php file
- How to override admin-bar style
- Refresh page after form action
- Check if a menu is empty?
- wp_get_attachment_image returns different image size
- Passing variables to templates (alternatives to globalizing variables)
- Load post with a different template?
- How to customize search result page title?
- Convert hyphen to underscore in permalinks
- How to fix a theme with page.php Default Template that accidentally deleted?
- WordPress Change Post Templates,but not drop down, but Image selection
- Returning Variables back into a template
- Using locate-template & shortcodes doesn’t appear to work
- Run Product Filter Javascript On Page Template
- Can I use require() function in a template file?
- How to set global variables in template page?
- Why isn’t is_page_template() adding a body class?
- Programmatically set page template based on page ID
- Query children and parent title
- How to make unique add_filter to the_content of specific page template files – so each template gets its own addition
- Generate permalinks
- how to change link of some wordpress pages
- Retrieve post modified date for specific post by post ID
- Filtering posts by category name based on page’s slug
- Is there a wordpress function that I can use to retrieve the current page that is loaded?
- How to include local menu based on page id?
- How to create function from code?
- How to extract the variables out from “add_shortcode” function?
- Default Gallery Edit/Template Editable?
- is_account_page() change to page slug
- Activate small php condition at footer over page template
- Retrieve tags data in post body
- Get_template_part inside a folder
- Functions For Calling Specific Elements
- How to get correct URLs in network wide menu (Multisite)?
- Where to add the permalink in this function?
- paginate_links() don’t properly work in search.php?
- Changing permalink name redirects to another template?
- different style sheet for just one page template
- How to fix get_the_category function returning incorrect slug?
- I have problems with loading javascripts
- Pass variable from action back to template
- Test if a post exists by category and date
- Best way to handle lack of titles in microblogging
- attachment page template? only show attachments for current post?
- Run a jquery script on on a certain template page
- How to include any template using Shortcode fuction?
- How to properly refresh page after form action?
- Image loading function not working on archive.php template
- Add a field into a shortcode of an extension
- Using functions.php to include code that’s processed inline
- How to make a new function that includes a template
- Setting Permalinks in wp_config or functions file?
- Redirect to post after publish or update a published post
- Page Template Won’t Load Correct CSS File
- Show admin page, only if function is being used
- Prevent creating multiple image resizes in twentytwelve template
- Function to check if custom page is used by page?
- Simplest Way to Build Custom Archives Page?
- Unable to use get_page_by_title() more than once per page?
- Display ACF category image on archive and single template files
- How to require a config file in a template and in function.php?
- How to add extra value to permalink
- Load templates, pass arguments, and render output from functions.php
- Changing the HTML of notices in WooCommerce [closed]
- How to Override Page Template if URL matches query?
- Probleme shortcode with list author
- Add #primary at the end of navlink permalinks on single posts
- Enqueue script if not page template
- WP Enqueue Script Error
- WordPress function with attribute pass to template
- Pagination won’t work on custom page
- Filter posts on new page
- Edit meta fields from within template
- Javascript and Stylesheet in child page
- Sending Messages Back to the Template After Processing?
- Newest comments first not working
- Retrieve a custom form field modified by a filter
- us states dropdown function and echo in theme template files
- How to pass a variable from a template page to the child theme functions.php
- Function the_content
- Allow the access over wp-login.php
- How to use different jquery function of idangero swiper dependant on page template?
- Exclude javascript in certain page url and all following url’s after forward slash
- Shortcode to output get_header not working
- Permalink / sub-template issue
- Adding css tweak based on page template
- How can i hide content if not friend in Buddypress? [closed]
- Which template file to edit to edit homepage in Mystile [closed]
- Loop on a wordpress Page instead of content coming from the WP text editor
- Make a PHP file with a function
- Creating mixture of shortcodes to use in the visual/text editor
- My website is generating weired url parameters of paginated pages
- Logout redirect via page template without confirmation?
- How to store page-{id}.php templates in custom folder