SlideShare a Scribd company logo
WordPress Theme
Workshop: Part 3
November 4th, 2017
David Bisset
davidbisset.com / @dimensionmedia
Theme Frameworks
Also Sometimes Known As “Starter Themes”
A theme framework as the core or foundation of a theme,
which allows users to create their own child themes even if
they have little or no experience in coding.
(See Email For List Of Theme Frameworks - Paid and Free)
What Is Underscores or _s?
Ultra-Minimal CSS theme
• A just right amount of lean, well-commented, modern, HTML5 templates.
• A helpful 404 template.
• A custom header implementation in inc/custom-header.php just add the
code snippet found in the comments of inc/custom-header.php to your
header.php template.
• Custom template tags in inc/template-tags.php that keep your templates
clean and neat and prevent code duplication.
• Some small tweaks in inc/template-functions.php that can improve your
theming experience.
• A script at js/navigation.js that makes your menu a toggled dropdown on
small screens (like your phone), ready for CSS artistry. It's enqueued in
functions.php.
• 2 sample CSS layouts in layouts/ for a sidebar on either side of your
content.
• Smartly organized starter CSS in style.css that will help you to quickly get
your design off the ground.
_s Starter Theme
http://underscores.me/
Download And Install _s Theme
http://underscores.me/
Download And Install _s Theme
http://underscores.me/
Why Is It Blank? No Screenshot.png
http://underscores.me/
Screenshot For Your Theme!
The screenshot should be
named screenshot.png, and
should be placed in the top
level directory.
The recommended image
size is 1200px wide by
900px tall.
Looking At _S Theme Structure
Common Files
header.php - This file will contain the code for the header section of the theme;
index.php - This is the main file for the theme. It will contain the code for the Main
Area and will specify where the other files will be included;
sidebar.php - This file will contain the information about the sidebar;
footer.php - This file will handle your footer;
style.css - This file will handle the styling of your new theme;
Template Tags
A template tag is simply a piece of code that tells
WordPress to get something from the database. It is
broken up into three components:
• A PHP code tag
• A WordPress function
• Optional parameters
Template Tags
For example, the template tag get_header() tells
WordPress to get the header.php file and include it in the
current theme file. Similarly, get_footer() tells WordPress
to get the footer.php file.
Template Tags
For example, the template tag get_header() tells
WordPress to get the header.php file and include it in the
current theme file. Similarly, get_footer() tells WordPress
to get the footer.php file.
Let’s Take A Closer Look!
Common Functions: wp_head();
Found in: header.php
Common Functions: wp_head();
Found in: header.php
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-
scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>
Common Functions: wp_footer();
Found in: footer.php
Common Functions: wp_footer();
Found in: footer.php
</div><!-- #content -->
<footer id="colophon" class="site-footer">
<div class="site-info">
<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'workshop-theme' ) ); ?
>"><?php
/* translators: %s: CMS name, i.e.WordPress. */
printf( esc_html__( 'Proudly powered by %s', 'workshop-theme' ),
'WordPress' );
?></a>
<span class="sep"> | </span>
<?php
/* translators: 1:Theme name, 2:Theme author. */
printf( esc_html__( 'Theme: %1$s by %2$s.', 'workshop-theme' ), 'workshop-
theme', '<a href="http://davidbisset.com">David Bisset</a>' );
?>
</div><!-- .site-info -->
</footer><!-- #colophon -->
</div><!-- #page -->
<?php wp_footer(); ?>
</body>
</html>
Common Functions: get_header();
Most Of Your Template Pages InYour Theme
/* 404.php */
<?php get_header(); ?>
<h2>Error 404 - Not Found</h2>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
https://codex.wordpress.org/Function_Reference/get_header
Common Functions: get_footer();
Most Of Your Template Pages InYour Theme
/* 404.php */
<?php get_header(); ?>
<h2>Error 404 - Not Found</h2>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
https://codex.wordpress.org/Function_Reference/get_footer
Common Functions: get_sidebar();
Most Of Your Template Pages InYour Theme
/* 404.php */
<?php get_header(); ?>
<h2>Error 404 - Not Found</h2>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
https://codex.wordpress.org/Function_Reference/get_sidebar
The WordPress “Loop”
The Loop is PHP code used by WordPress to display posts.
Using The Loop,WordPress processes each post to be
displayed on the current page, and formats it according to
how it matches specified criteria within The Loop tags.
The WordPress “Loop”
<?php
get_header();
if (have_posts()) :
while (have_posts()) :
the_post();
the_content();
endwhile;
endif;
get_sidebar();
get_footer();
?>
The WordPress “Loop”
<?php
get_header();
if (have_posts()) :
while (have_posts()) :
the_post();
the_content();
endwhile;
endif;
get_sidebar();
get_footer();
?>
The WordPress “Loop”
<?php
get_header();
if (have_posts()) :
while (have_posts()) :
the_post();
the_content();
endwhile;
endif;
get_sidebar();
get_footer();
?>
it checks whether any posts were discovered
If there were any posts, let’s do this until
there are no more
“loads up” the post and it’s data
The the_content() template tag fetches
the content of the post, filters it, and
then displays it.
The WordPress “Loop”
<?php
get_header();
if (have_posts()) :
while (have_posts()) :
the_post(); ?>
<article>
<?php the_content(); ?>
</article>
<?php
endwhile;
endif;
get_sidebar();
get_footer();
?>
The WordPress “Loop”
<?php
get_header();
if (have_posts()) :
while (have_posts()) :
the_post(); ?>
<article>
<?php the_content(); ?>
</article>
<?php
endwhile;
endif;
get_sidebar();
get_footer();
_s single.php
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<?php
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content', get_post_type() );
the_post_navigation();
// If comments are open or we have at least one comment, load up the comment
template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile; // End of the loop.
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_sidebar();
get_footer();
get_template_part()
<?php get_template_part( 'partials/content', 'page' ); ?>

More Related Content

PDF
NewBCamp09: Turning your design into a WordPress Theme
PDF
Arizona WP - Building a WordPress Theme
PDF
WordPress Theme Development for Designers
PPTX
Custom WordPress theme development
ODP
Creating Themes
PPT
Wordpress & HTML5 by Rob Larsen
PDF
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
PPTX
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
NewBCamp09: Turning your design into a WordPress Theme
Arizona WP - Building a WordPress Theme
WordPress Theme Development for Designers
Custom WordPress theme development
Creating Themes
Wordpress & HTML5 by Rob Larsen
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
WordPress theme development from scratch : ICT MeetUp 2013 Nepal

What's hot (20)

PDF
How does get template part works in twenty ten theme
PPTX
WordPress Theme Development: Part 2
PDF
Intro to WordPress theme development
PPTX
Customizing WordPress Themes
PDF
Introduction to WordPress Theme Development
DOC
Wordpress(css,php,js,ajax)
ODP
Drupal 7 Theming - what's new
PDF
WordPress Theme Structure
PDF
Word press templates
PDF
Adopt or hack - how to hack a theme in a Drupal way
PPT
WordPress Theme Design - Rich Media Institute Workshop
PPTX
Rebrand WordPress Admin
PDF
Seven deadly theming sins
PDF
WordPress Theme Development
PPTX
Converting (X)HTML/CSS template to Drupal 7 Theme
PDF
Atomicant Drupal 6 Theming
PPTX
Learning Wordpress - the internal guide
PPT
WordPress 2.5 Overview - Rich Media Institute
ODP
Drupal
PPT
Power Theming
How does get template part works in twenty ten theme
WordPress Theme Development: Part 2
Intro to WordPress theme development
Customizing WordPress Themes
Introduction to WordPress Theme Development
Wordpress(css,php,js,ajax)
Drupal 7 Theming - what's new
WordPress Theme Structure
Word press templates
Adopt or hack - how to hack a theme in a Drupal way
WordPress Theme Design - Rich Media Institute Workshop
Rebrand WordPress Admin
Seven deadly theming sins
WordPress Theme Development
Converting (X)HTML/CSS template to Drupal 7 Theme
Atomicant Drupal 6 Theming
Learning Wordpress - the internal guide
WordPress 2.5 Overview - Rich Media Institute
Drupal
Power Theming
Ad

Similar to WordPress Theme Workshop: Part 3 (20)

PDF
WordPress Theme Workshop: Part 4
PDF
WordPress Theming 101
PPTX
WordPress Themes 101 - HighEdWeb New England 2013
PPTX
WordPress Themes 101 - dotEduGuru Summit 2013
PPTX
Design todevelop
PDF
Builing a WordPress Theme
PPTX
Wordpress theme development
PPTX
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
PPTX
WordPress Themes 101 - PSUWeb13 Workshop
PPTX
Your First Wordpress Theme
PPTX
MCC Web Design Workshop
PPTX
The Way to Theme Enlightenment 2017
PPTX
The Way to Theme Enlightenment
PDF
Dissecting WordPress Themes and Page Templates, WordPress Columbus Meetup
PPTX
Introduction to Custom WordPress Themeing
PPTX
Building a WordPress theme
PDF
WordPress Essentials for Beginners - YES Montreal December 2014
PPT
Wordcamp 2010 Themes for Beginners
PPT
Wordcamp 2010 Themes for Beginners
PPT
Wordcamp 2010 Themes for Beginners
WordPress Theme Workshop: Part 4
WordPress Theming 101
WordPress Themes 101 - HighEdWeb New England 2013
WordPress Themes 101 - dotEduGuru Summit 2013
Design todevelop
Builing a WordPress Theme
Wordpress theme development
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
WordPress Themes 101 - PSUWeb13 Workshop
Your First Wordpress Theme
MCC Web Design Workshop
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment
Dissecting WordPress Themes and Page Templates, WordPress Columbus Meetup
Introduction to Custom WordPress Themeing
Building a WordPress theme
WordPress Essentials for Beginners - YES Montreal December 2014
Wordcamp 2010 Themes for Beginners
Wordcamp 2010 Themes for Beginners
Wordcamp 2010 Themes for Beginners
Ad

More from David Bisset (20)

PDF
WordPress Theme Workshop: Part 0
PDF
WordPress Theme Workshop: Part 1
PDF
WordPress Theme Workshop: Part 2
PDF
WordPress Theme Workshop: Customizer
PDF
WordPress Theme Workshop: CSS/JS
PDF
WordPress Theme Workshop: Internationalization
PDF
WordPress Theme Workshop: Misc
PDF
WordPress Theme Workshop: Widgets
PDF
WordPress Theme Workshop: Menus
PDF
WordPress Theme Workshop: Sidebars
PDF
WordPress Theme Workshop: Theme Setup
PPTX
BuddyPress & Higher Education
PDF
WordPress Meetup (Davie, FL) - Top 9 April 2016
PDF
WordCamp Tampa 2015
PDF
BuddyPress v4
PDF
WPSessions - Thinking Outside The Box With BuddyPress
PDF
SunShine PHP
PDF
Building Next Generation Applications With BuddyPress
PDF
Be a Part of Something Bigger: Get Involved with WordPress
PDF
WordPress Meetup - Top 9 September 2015
WordPress Theme Workshop: Part 0
WordPress Theme Workshop: Part 1
WordPress Theme Workshop: Part 2
WordPress Theme Workshop: Customizer
WordPress Theme Workshop: CSS/JS
WordPress Theme Workshop: Internationalization
WordPress Theme Workshop: Misc
WordPress Theme Workshop: Widgets
WordPress Theme Workshop: Menus
WordPress Theme Workshop: Sidebars
WordPress Theme Workshop: Theme Setup
BuddyPress & Higher Education
WordPress Meetup (Davie, FL) - Top 9 April 2016
WordCamp Tampa 2015
BuddyPress v4
WPSessions - Thinking Outside The Box With BuddyPress
SunShine PHP
Building Next Generation Applications With BuddyPress
Be a Part of Something Bigger: Get Involved with WordPress
WordPress Meetup - Top 9 September 2015

Recently uploaded (20)

PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
A Presentation on Artificial Intelligence
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Approach and Philosophy of On baking technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
The AUB Centre for AI in Media Proposal.docx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Encapsulation_ Review paper, used for researhc scholars
Mobile App Security Testing_ A Comprehensive Guide.pdf
Big Data Technologies - Introduction.pptx
Spectral efficient network and resource selection model in 5G networks
Empathic Computing: Creating Shared Understanding
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
The Rise and Fall of 3GPP – Time for a Sabbatical?
A Presentation on Artificial Intelligence
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Diabetes mellitus diagnosis method based random forest with bat algorithm
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Per capita expenditure prediction using model stacking based on satellite ima...
MYSQL Presentation for SQL database connectivity
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Approach and Philosophy of On baking technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

WordPress Theme Workshop: Part 3

  • 1. WordPress Theme Workshop: Part 3 November 4th, 2017 David Bisset davidbisset.com / @dimensionmedia
  • 2. Theme Frameworks Also Sometimes Known As “Starter Themes” A theme framework as the core or foundation of a theme, which allows users to create their own child themes even if they have little or no experience in coding. (See Email For List Of Theme Frameworks - Paid and Free)
  • 3. What Is Underscores or _s? Ultra-Minimal CSS theme • A just right amount of lean, well-commented, modern, HTML5 templates. • A helpful 404 template. • A custom header implementation in inc/custom-header.php just add the code snippet found in the comments of inc/custom-header.php to your header.php template. • Custom template tags in inc/template-tags.php that keep your templates clean and neat and prevent code duplication. • Some small tweaks in inc/template-functions.php that can improve your theming experience. • A script at js/navigation.js that makes your menu a toggled dropdown on small screens (like your phone), ready for CSS artistry. It's enqueued in functions.php. • 2 sample CSS layouts in layouts/ for a sidebar on either side of your content. • Smartly organized starter CSS in style.css that will help you to quickly get your design off the ground.
  • 5. Download And Install _s Theme http://underscores.me/
  • 6. Download And Install _s Theme http://underscores.me/
  • 7. Why Is It Blank? No Screenshot.png http://underscores.me/
  • 8. Screenshot For Your Theme! The screenshot should be named screenshot.png, and should be placed in the top level directory. The recommended image size is 1200px wide by 900px tall.
  • 9. Looking At _S Theme Structure
  • 10. Common Files header.php - This file will contain the code for the header section of the theme; index.php - This is the main file for the theme. It will contain the code for the Main Area and will specify where the other files will be included; sidebar.php - This file will contain the information about the sidebar; footer.php - This file will handle your footer; style.css - This file will handle the styling of your new theme;
  • 11. Template Tags A template tag is simply a piece of code that tells WordPress to get something from the database. It is broken up into three components: • A PHP code tag • A WordPress function • Optional parameters
  • 12. Template Tags For example, the template tag get_header() tells WordPress to get the header.php file and include it in the current theme file. Similarly, get_footer() tells WordPress to get the footer.php file.
  • 13. Template Tags For example, the template tag get_header() tells WordPress to get the header.php file and include it in the current theme file. Similarly, get_footer() tells WordPress to get the footer.php file. Let’s Take A Closer Look!
  • 15. Common Functions: wp_head(); Found in: header.php <!doctype html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo( 'charset' ); ?>"> <meta name="viewport" content="width=device-width, initial- scale=1"> <link rel="profile" href="http://gmpg.org/xfn/11"> <?php wp_head(); ?> </head>
  • 17. Common Functions: wp_footer(); Found in: footer.php </div><!-- #content --> <footer id="colophon" class="site-footer"> <div class="site-info"> <a href="<?php echo esc_url( __( 'https://wordpress.org/', 'workshop-theme' ) ); ? >"><?php /* translators: %s: CMS name, i.e.WordPress. */ printf( esc_html__( 'Proudly powered by %s', 'workshop-theme' ), 'WordPress' ); ?></a> <span class="sep"> | </span> <?php /* translators: 1:Theme name, 2:Theme author. */ printf( esc_html__( 'Theme: %1$s by %2$s.', 'workshop-theme' ), 'workshop- theme', '<a href="http://davidbisset.com">David Bisset</a>' ); ?> </div><!-- .site-info --> </footer><!-- #colophon --> </div><!-- #page --> <?php wp_footer(); ?> </body> </html>
  • 18. Common Functions: get_header(); Most Of Your Template Pages InYour Theme /* 404.php */ <?php get_header(); ?> <h2>Error 404 - Not Found</h2> <?php get_sidebar(); ?> <?php get_footer(); ?> https://codex.wordpress.org/Function_Reference/get_header
  • 19. Common Functions: get_footer(); Most Of Your Template Pages InYour Theme /* 404.php */ <?php get_header(); ?> <h2>Error 404 - Not Found</h2> <?php get_sidebar(); ?> <?php get_footer(); ?> https://codex.wordpress.org/Function_Reference/get_footer
  • 20. Common Functions: get_sidebar(); Most Of Your Template Pages InYour Theme /* 404.php */ <?php get_header(); ?> <h2>Error 404 - Not Found</h2> <?php get_sidebar(); ?> <?php get_footer(); ?> https://codex.wordpress.org/Function_Reference/get_sidebar
  • 21. The WordPress “Loop” The Loop is PHP code used by WordPress to display posts. Using The Loop,WordPress processes each post to be displayed on the current page, and formats it according to how it matches specified criteria within The Loop tags.
  • 22. The WordPress “Loop” <?php get_header(); if (have_posts()) : while (have_posts()) : the_post(); the_content(); endwhile; endif; get_sidebar(); get_footer(); ?>
  • 23. The WordPress “Loop” <?php get_header(); if (have_posts()) : while (have_posts()) : the_post(); the_content(); endwhile; endif; get_sidebar(); get_footer(); ?>
  • 24. The WordPress “Loop” <?php get_header(); if (have_posts()) : while (have_posts()) : the_post(); the_content(); endwhile; endif; get_sidebar(); get_footer(); ?> it checks whether any posts were discovered If there were any posts, let’s do this until there are no more “loads up” the post and it’s data The the_content() template tag fetches the content of the post, filters it, and then displays it.
  • 25. The WordPress “Loop” <?php get_header(); if (have_posts()) : while (have_posts()) : the_post(); ?> <article> <?php the_content(); ?> </article> <?php endwhile; endif; get_sidebar(); get_footer(); ?>
  • 26. The WordPress “Loop” <?php get_header(); if (have_posts()) : while (have_posts()) : the_post(); ?> <article> <?php the_content(); ?> </article> <?php endwhile; endif; get_sidebar(); get_footer();
  • 27. _s single.php get_header(); ?> <div id="primary" class="content-area"> <main id="main" class="site-main"> <?php while ( have_posts() ) : the_post(); get_template_part( 'template-parts/content', get_post_type() ); the_post_navigation(); // If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || get_comments_number() ) : comments_template(); endif; endwhile; // End of the loop. ?> </main><!-- #main --> </div><!-- #primary --> <?php get_sidebar(); get_footer();