Dustin Leer
Front End Developer, Synapse Marketing
@leerdustin
I started as a designer. I currently work primarily as a front end developer for Synapse Marketing Solutions in Lancaster, PA.
A Child Theme allows you to change aspects of your site’s appearance yet still preserve your theme’s look and functionality.
A Template in WordPress is a PHP file that determines how content is displayed.
Examples.md
'style.css' - Controls the setup
of a child theme
'page.php' - Controls how single
pages are displayed
'single.php' - Controls how single blog
posts are displayed
'archive.php' - Controls how archive pages
are displayed
'category.php' - Controls category
archive pages
page.php
singular.php
index.php
full-width.php
sidebar-custom.php
style.css
/*------------------------------------------------------
Theme Name: Storey Child
Theme URI: http://www.themezilla.com
Author: Dustin Leer
Author URI: http://www.dustinleer.com
Description: Child theme for Dustin Leer.
Version: 1.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: zilla
Domain Path: /languages/
Template: storey
------------------------------------------------------*/
style.css
<?php /* Template Name: Full Width (No Sidebar) */ ?>
<?php get_header(); ?>
<div id="content">
<div id="inner-content" class="row">
<main id="main" class="large-12 medium-12 columns" role="main">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<!-- Here is our loop -->
<?php get_template_part( 'parts/loop', 'page' ); ?>
<?php endwhile; endif; ?>
</main> <!-- end #main -->
</div> <!-- end #inner-content -->
</div> <!-- end #content -->
<?php get_footer(); ?>
full-width.php
<?php /* Template Name: Sidebar Custom */ ?>
<?php get_header(); ?>
<div id="content">
<div id="inner-content" class="row">
<main id="main" class="large-8 medium-8 columns" role="main">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<!-- Here is our loop -->
<?php get_template_part( 'parts/loop', 'page' ); ?>
<?php endwhile; endif; ?>
</main> <!-- end #main -->
<!-- This is our sidebar, but where's the html??? -->
<?php get_template_part( 'parts/sidebar.php' ); ?>
</div> <!-- end #inner-content -->
</div> <!-- end #content -->
<?php get_footer(); ?>
sidebar-custom.php
<!-- This is our sidebar, but where's the html??? -->
<?php get_template_part( 'parts/sidebar.php' ); ?>
<!-- This is our sidebar, but where's the html??? -->
<?php get_template_part( 'parts/sidebar.php' ); ?>
<?php /* The template for displaying all single posts. */
get_header(); ?>
<?php if( get_template_part('parts/hero_single') ): ?>
<?php get_template_part( 'parts/hero_single' ); ?>
<?php endif; ?>
<section class="page_content"> ...
</section>
<?php if( get_template_part('parts/recent-posts-extended') ): ?>
<?php get_template_part( 'parts/recent-posts-extended' ); ?>
<?php endif; ?>
<?php get_footer(); ?>
single.php
I'm calling several pieces located in a folder/directory called parts.
FOLDERS
our-theme
img
inc
js
languages
layouts
scss
parts
templates
404.php
archive.php
comments.php
Ok, so we've come across this more than once now.
What are template parts?
Why should you use them?
Are they really needed?
header.php
footer.php
sidebar.php
header-custom.php
footer-custom.php
sidebar-custom.php
sidebar.php
You can find me at dustinleer.com
@leerdustin
@leerdustin
dustinleer
sidebar.php