how to show single post in a custom template
In most templates, the file single.php is used to display a single post. So you can use the code from the subpage template file in single.php to style a single post.
In most templates, the file single.php is used to display a single post. So you can use the code from the subpage template file in single.php to style a single post.
“advice on the best approach” questions do not make for very good questions here as they tend to be pretty broad and subject to opinion, but I’ll give you some options and hope for the best. Option 1: You should be able to use ordinary pages for this. Create templates for your custom content just … Read more
You may not completely get out without using a template file. I might be wrong!!. But, by using get_template_part in your single-product.php you will be able to use page-three-column.php file. So in your single-product.php something like this should do. <?php get_template_part( ‘page-three-column.php’ ); ?> You may refer to the Codex here.
Page attributes missing
According to the Theme Guide, full loops should be used, even on single templates. Full loops must be used in all templates. Just calling the_post() in a template like single.php or page.php is not enough. So yes, it’s a best practice to use full loops.
The problem seems to be in the Loop. Inside the Loop you are not incrementing the $the_query. You may change the code for the Loop as below: // The Loop if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); // Add this line to fix the issue smr_product_the_frontend_item(); } } else { // … Read more
If you want your pages to look exactly like your home page, you could simply copy the code from index.php to page.php. You would then have to ensure that any content loop or the_content() was being used properly.
This question is opinion based, so the answer can be opinion based too. I assume that, if you need to paginate the posts, you are building a page template to look like an archive page. In this case I totally recommend to use an archive page and to use pre_get_posts action hook for filter the … Read more
The page_template is a filter, not an action. Specifically it’s filtering the file path of the template to be included. So really you shouldn’t be loading anything in that callback (it’s too early). Instead just return its file path. add_filter( ‘page_template’, ‘load_tq_templates’ ); function load_tq_templates( $template ) { if ( is_page( ‘transport-quote-1’ ) ) { … Read more
This is what finally worked for me. To pull in the banner (featured) image from another page, create the search-results page in WordPress and make sure it is excluded from the search results by using the Search Exclude plugin, then add your featured image and pop this into your two-column custom template: <?php if (is_search()) … Read more