You can use locate_template()
.
locate_template( 'page-template2', true );
Related Posts:
- Serving precompressed content with Brotli on Apache
- How can I avoid code duplication for a blog with lots of source code?
- How to rename wp-includes folder?
- What’s the correct way to include files in WordPress TwentyTen theme with it’s own jquery scripts and css?
- ABSPATH not working! Any idea why?
- Get current user data from external PHP page
- External system integration with wordpress
- Why does get_template_part() break variables?
- How to pass variables with get_template_part?
- Include a specific page in your template
- Problems Including File
- How to include core files into plugin
- How to check if txt file exists inside template folder?
- What’s the best way to ‘include’ a file in WordPress?
- locate_template function – File not getting included
- Include content from one page to another
- If a page does not exist, include a different page?
- Can not include file from plugin into theme
- Include tags from array, ignore the rest in get_the_tags
- PHP files included within functions.php don’t work from admin area
- Wp Enviroment problem with included file
- What’s the best way to include PHP code in pages?
- confused about wp_list_pages() function – how to display selected top pages with all their subpages
- include specific Pages to wp_list_pages with filter
- Having trouble linking to file using relative path
- How can I include an external file in a post or page?
- require_once not working
- Including php file in directory above WordPress installation
- add_feed failed to open stream
- Load content From Include File within plugin
- query_posts doesnt show pages with given ID when post_type => page
- including Zend Gdata library path error
- Displaying page content from plugin, inside exising empty WP page
- What about “inc” (include) files and Child Theming? Is it possible?
- Make changes in /includes/http.php update safe
- loading a php file to a specific page id
- Need to override file included in parent theme
- Class works in Admin, not found on Front End
- if statement parent page for child pages
- add_action outside a plugin
- Dynamically determine URI to scripts and styles included with a class which could be added from plugin/theme/child theme/mu plugin
- Include another HTML file in a HTML file
- C++ #include guards
- C++ #include guards
- Inserting a PDF file in LaTeX
- How do I run a file on localhost?
- class not declared in scope – even though .h was included
- Already defined in .obj – no double inclusions
- How do you #include files in java?
- How do I include a JavaScript file in another JavaScript file?
- Random not declared in scope
- “Multiple definition”, “first defined here” errors
- Error “Unterminated conditional directive” in cross-referencing headers
- “Fatal error: Cannot redeclare function”
- What is the difference between a .cpp file and a .h file?
- Difference between require, include, require_once and include_once?
- How to include file in a bash shell script
- cmath vs math.h (And similar c-prefixed vs .h extension headers)
- How to add a default include path for GCC in Linux?
- Compiler error C4430: missing type specifier – int assumed [duplicate]
- Eclipse CDT: Symbol ‘cout’ could not be resolved
- how to get wp-content folder in wordpress?
- Is it possible to get a page link from its slug?
- Add infinite scroll to content splitted post
- get_template_directory_uri pointing to parent theme not child theme
- Passing variables through locate_template
- Check if wp-login is current page
- How to get current page ID outside the loop?
- Sending the reset password link programatically
- Is there any way to use get_template_part() with folders?
- Contact Form on WordPress Sites?
- Page returns 404 with POST variables, but not without
- Determine if page is the Posts Page
- Custom templates not showing up in template dropdown
- Hook for post and page load
- Getting only direct child pages in WordPress with get_pages
- Get page id by template
- Page template query with WP_Query
- Get the Current Page Number
- Using pre_get_posts on true pages and static front pages
- Get the content of a specific page (by ID)
- How to get page title with the page ID?
- Show more than 20 items in pages or posts edit dashboard
- Allowing user to edit only certain pages
- Pass PHP variable to javascript
- Get page content using slug
- How to display last 3 posts (recent posts) in a static page?
- wp_nav_menu: show menu only if one exists, otherwise show nothing
- How to display page content in a page template?
- How to give paged links custom title?
- How to set post slug when using wp_insert_post();?
- Integrating a custom post type into a page hierarchy
- Why isn’t is_page working when I put it in the functions.php file?
- How to enable custom fields for pages (if not a bad practice)?
- Custom Post Type Slug / Page Slug Conflict – Prevent use of reserved slug on page save?
- How can I keep the content of my pages version controlled?
- The proper way to include/require PHP files in WordPress
- How to load javascript on custom page template?
- How to check if I’m on the last page of posts?
- How to configure WordPress to handle 75,000 pages?