• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2784

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Consultation
  • Full Access
  • Log in

Load Template File Conditionally

This code loads the template file named featured.php from the child themes root directory.

You can use the code in your child themes functions.php file to load any type of template file conditionally.

In this case it uses the is_singular('page') conditional tag to load the template file named featured.php on all single pages.

Load Single Post Template On Single Pages

If you want to use a single.php post template on single pages you can add a template header to the file like this :

/**
 * Template Name: Single Page Template
 */

This enables you to choose the Single Page Template from the Templates drop down menu in the Page Attributes box on any single page.

Reader Interactions

Comments

  1. Collins Agbonghama says

    January 22, 2018 at 7:42 am

    Thanks Brad for all the code snippets you share. Glad to have found your site via Google.

    Log in to Reply
    • Brad Dalton says

      January 22, 2018 at 7:46 am

      You’re welcome Collins

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags