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
- How to include file in a bash shell script
- Disable Attachment Pages Completely
- Slugs as breadcrumbs for Pages
- How restrict page for users logged? [closed]
- Only allow new subpages to be created
- Add a custom option to a page in backend
- Targeting specific pages in the loop
- Replace existing pages with new pages, keep menu links
- Can I create multiple instances of the BuddyPress Activity Stream with separate themes? [closed]
- List Child Pages of Parent Parent Page (Child pages from Grand Parent)
- Can a page_id and a post_id be same?
- How can plugins have their own pages?
- How to add meta boxes to Pages
- How do I use the Simple HTML DOM Parser in plugin when other plugin already uses it?
- Hiding Page by Title from Editing
- Should I use include or load_template for including shortcodes, plugins and so on?
- Page vs Custom Post Types Differences/Issues
- Make parts of your wordpress website completely built with data from external APIs?
- Use of Templates in a Plugin
- Could be a namespace conflict (?) with login form and register form on the same page
- Top Level pages in wordpress giving 404, but child pages working fine
- The concept of non-blog content
- Why does abstracting html from plugin code result in loss of access to wordpress functions?
- How to list a page tree?
- WordPress pages not working out correctly with HTML
- Change page name in admin list
- WordPress 302 Redirect to Random Product/Post/Page
- Get post content from outside the loop with plugin shortcode usability
- Manage content on multiple pages synchronysly?
- get_page() – Only variables can be passed by reference
- Custom query does not find pages
- Need Help with Custom ModRewrite
- Website jumps to top when scrolling down
- Revert a Draft page to its original version
- How to use custom page for all posts with custom url, call another directory?
- Link to a page before launch
- What plugin would make this happen? If is the theme
- get_template_part for template in subdirectory not working
- How can I create a Custom Page? (not a page template!!)
- My edits are not saved
- Custom non-template page on front end fails to render
- Add addtional page parameter before loading the page
- Unregistered taxonomy apears still as emtpy filter list
- Use page-templates without creating theme
- Including admin-options.php file in Child Themes
- How can I use a specific wordpress page template if certain words are used in page title [closed]
- Category Archive not working for pages
- How do I control the list of Pages an author can see?
- Create page excerpts for landinpage
- Why my site scroll top when end load pages
- Converting Posts to Pages
- Allow arbitrary text after page URL
- How to make page navigation just below the content?
- The next_posts_link() works only with original $wp_query
- get_pages not returning any results or error when get_posts works
- Adding Media button to only pages
- Archive with specific keyword by category sorted by date
- Redirecting posts in WordPress to a specific page
- Recommendation for a Dynamic Table Plugin [closed]