SEO Book PRO SEO Dashboard v0.0.16 Login Rich Snippets

5 Steps to get_header() and get_footer() from specific WordPress Template Folder

Article Details and Information
badge This article was written by SEO Book Pro | Published on 3:25 pm, Fri, 5 March 21
SEO Book Pro Headline Feed rss_feed
Do you have content that you want on SEO Book Pro?
Here are a few ways to submit it to us.

SEO | Website Audit | WordPress SEO | SEO Audit Tools

↑ Grab this Headline Animator

Subscribe to Our Newsletter

Powered by FeedBurner

Enter your email address:

Delivered by FeedBurner

get_header and get_footer for WordPress Template

get_header() and get_footer() from specific WordPress Template Folder


Step One: Create Custom Page Template in your root WordPress theme folder


Instead of adding an additional new custom template file in your WordPress template folder, you can create a new folder with a specific name to serve any custom WordPress Page Templates to assign them to specific Pages in your WordPress website.


I Got a new Land Page in the WordPress Page Templates Folder Like the example below:

page-templates/landing-amp.php

To get the new custom page template layout available to assign it to your specific page on the website you need to hook the function for this.


Step Two: At the top of your custom page template file add the related function from WordPress Codex


<?php /* Template Name: Landing AMP Projects */;?>


To learn more about how it’s work visit Creating Custom Page Templates for Global Use


Step Three: Create New Folder in your WordPress root Template Folder to serve the new files for get_header() and get_footer() functions


In my example, I create a new folder in my current active WordPress Template folder with the name “lamp“. In the new folder create your custom get_header() and get_footer() files to load on your custom page template. The customized head and footer files are served as template parts and are not necessary to name them with

  • header-{custom-name}.php
  • footer-{custom-name}.php

This is because we will get them with the WordPress function get_template_part() and will not serve this 2 new header and footer required WordPress Template files from the root how it is by the default function for WordPress Templates to include Template Tags – Include_Tags


Step Four: Create two new files in the “lamp” folder as the example below

  • /lamp/header-amp.php
  • /lamp/footer-amp.php

Step Five: Open your Custom Page Template from Step One and below the 1st-row code the snippets below


  • <?php get_template_part( ‘lamp/header-amp’ );?>
  • <?php get_template_part( ‘lamp/footer-amp’ );?>

Recommended Article about the next part of loading the content on those new pages with running the basic Loop and display your WordPress Page Content

What the_content and get_the_content are used in WordPress?
What the_permalink and get_the_permalink functions are used for in WordPress?
How to create a simple WordPress Loop for posts?


05/03/2021 by SEO Book Pro
SEO Book Pro
5 stars
Technical SEO Audit
Quiet Valley Lane Sherman Oaks
Poway, CA 91403
8779 02354