I believe you need to use get_template_part
, but you need to request the get_page_template_slug
first.
So that would look like:
get_template_part( get_page_template_slug( get_the_ID() ) );
in lieu of
echo get_page_template();
And no need to echo it, it returns the template already printed.
Related Posts:
- How to display page content in a page template?
- Return parent post with its children using WP_Query?
- Single page theme
- Single page theme that uses pages for the content
- Trying to list out child pages with WP_Query
- Front End Sorting Questions
- What are the differences between “Latest Posts” and “Static Page”?
- WP_Query doesn’t get sticky post at the top, when used in a page template
- Pagination of a WP_Query Loop in a child-page page template
- Get pagination working for custom loops within page templates
- How is WP_Query parsed to determine which template to request?
- WordPress Pagination changes my template
- add_filter(‘query_vars’) not working in custom template
- Pass $page_id to new WP_Query
- Pagination on template page for custom query redirecting to index.php
- Create a page template for “top rated posts” but show full content and not just a list
- Get post and its children with WP_Query
- WP_Query returns different results from get_posts() [closed]
- inserting content of 1 Post to in another with a template hierarchy
- How to generate feed for custom template
- WP_Query with multiple orderby NOT working with ASC and DESC, what’s wrong?
- wp_query on page template not working (Genesis framework)
- Pagination for custom loop on custom page template is not displaying anything
- How to create Page templates for showing Blog posts in different layouts?
- wp list pages using meta box value
- Page template doesn’t display simple HTML if inserted into other page?
- How to separate two columns from one content on a page template?
- What’s the best way to make a blog page on WordPress?
- How to use custom page for all posts with custom url, call another directory?
- INNER JOIN custom tables – SQL Query
- Pagination Shows Up But Won’t Work on Custom Gallery Page
- How to exclude posts by ID within a category/archive loop
- How can I use a specific wordpress page template if certain words are used in page title [closed]
- Fetching $_POST from Page Template into functions.php
- Using URL variables on a custom WP_Query
- Pagination is not working on custom query inside a custom home page template
- Passing query variables to a custom page template
- When importing a database any page with a wp_query in doesn’t work
- Having trouble using this post category query on multiple pages?
- Adding css tweak based on page template
- WordPress pagination returns the same posts
- Posts with at least 3 tags of a list of tags
- Get post count of current loop when using multiple queries on one page
- Use WP_Query with a custom SQL query
- Pagination not working for Custom search form & custom result template
- Looping through tabular data
- Using next/previous_posts_link with customised search
- How to detect custom query inside `posts_where` hook?
- Is temporarily overwriting $wp_query a bad idea?
- Array Chunks and Inserting Varying HTML in WP_Query
- Filter user list that meta_value is empty
- Query wp_usermeta alongside wp_users
- How to output different posts per page?
- Modifying the Search Results
- WP_Query times out
- ACF – Get lowest & highest value from field
- What format does the meta_query TIME type require?
- How to find a post id using the post_excerpt?
- wp_query add arguments using array_push if variable met
- tax_query: Order by slug?
- WP_Query filter and order by meta ordering by wrong joined table
- WP_Query last five posts, simply ordered by meta_value
- Complex WP SQL Query
- Hide Administrators From User List except current user (administrator)
- Custom Query num_rows returns wrong amount
- How to figure out redirection and contents in hybrid solution containing word press content and legacy code (ASP.net)
- Category applied to pages, creates multiple breadcrumb entries after a search query (On the translated site)
- Most commented post showing 2 records
- How to store and receive variables in WP sessions?
- How to list posts with disabled/closed comments, with pagination?
- Category ‘pad_counts’ & ‘parent’ conflict
- How to exclude Sticky from Recent Post?
- Display if author page is author page of current user
- WP_Query order by not working properly due to category I believe
- get_query_var always returns the default value
- Modify WP_Query using pre_get_posts but only for frontend query?
- Function to retrieve IDs of posts, cache results, and improve wp_query
- parse_tax_query causing Navigation Menu To Disappear
- the_post_thumbnail do 2 queries. How to optimize
- Search.php – return number of results but cannot loop through
- Creating ‘posts page’ loop based on the page itself
- How to get pages of parent (non-recursive)?
- Can’t get term id for category archive
- Combine query in WP_User_Query()
- Nearby locations using Advanced custom fields, maps?
- How to get_comments() ordered by date and parent?
- WPQuery loop not giving expected output
- WP Query filters active on wrong query
- Not able to fetch woocommerce variation sales products for particular category products
- Global page ID variable empty error
- Gather same custom field values in one value in a select tag with wp_query
- Order Posts By Youtube Views
- WP Query with sticky posts and tax_query
- Declare inline background image in functions.php
- Run next query based on first query’s term
- Looking for a way to exclude frontpage and nav menu from query filter
- Query posts by custom fields
- WP Query Obj: Set value to be unequal | Hide media by admin
- I want to capture the last day’s (today) posts in a category in the numbered order in acf
- How do I have multiple metaqueries inside one wordpress query