Page Templating :: 2018-05-24 22:59:45

Page Templating

May 24th, 2018
WordPress Page Templating
Author: RoaringBull

undefined

Speedway Fight Club

[excerpt]WordPress Page Templating system. Under revision…[/excerpt]

Which template is called is not a complicated process, and will shape your strategies for query formulation.This is for what is displayed at your site’s main URL. “Front Page” is the static “page”, if set, index.php or page.php if exists… “Blog Homepage” is the page that shows the time-based blog content of the site and is dependent on what is configured in Admin Panel => Settings => Reading “Your homepage displays” => ( “Your Latest Posts” | “A static page(select below)” => (“Home Page” => select, “Posts pages” => select) ).

<?php
if ( is_front_page() && is_home() ) :
// Default homepage
elseif (is_front_page()):
//Static homepage
elseif ( is_home()):
//Blog page
else:
//everything else
endif;
?>
</code>
is_single({$slug/$ID})// Returns true if the page is currently displaying a single post
is_page({$slug/$ID})
is_singular({$slug/$ID})

https://developer.wordpress.org/themes/template-files-section/page-template-files/

    is_page({$slug/$ID})

    Page Template

    If the page has a custom template assigned, WordPress looks for that file and, if found, uses it.

  1. page-{slug}.phpIf no custom template has been assigned, WordPress looks for and uses a specialized template that contains the page’s slug.
  2. page-{id}.phpIf a specialized template that includes the page’s slug is not found, WordPress looks for and uses a specialized template named with the page’s ID.
  3. page.phpIf a specialized template that includes the page’s ID is not found, WordPress looks for and uses the theme’s default page template.
  4. singular.phpIf page.php is not found, WordPress looks for and uses the theme’s template used for a single post, irregardless of post type.
  5. index.phpIf no specific page templates are assigned or found, WordPress defaults back to using the theme’s index file to render pages.
  1. is_page({$slug/$ID})

    https://developer.wordpress.org/themes/template-files-section/post-template-files/

    WordPress Version 4.3 added singular.php that comes in the hierarchy after single.php for posts, page.php for pages, and the variations of each. This template follows the rules of is_singular() and is used for a single post, regardless of post type.

The fundamental triangle of WordPress page templating system.

index.php
single.php
page.php

The fundamental bipedal of WordPress page templating system.

index.php
singular.php

Having a diagram that shows you which page/post is selected acording to the page templating process is wonderful, but how do I keep a navbar, sidebar, or even a list of links on the front leading to the actual page/post?

what is the fundamental process, link page and/or post, display content…

that’s what is coming here… along with a link to a starter tutorial kit hosted on github

«