SlideShare une entreprise Scribd logo
1  sur  30
Télécharger pour lire hors ligne
WordPress Theme
Workshop: Part 4
November 4th, 2017
David Bisset
davidbisset.com / @dimensionmedia
UnderStrap
http://underscores.me/
Creating A Homepage
Let’s just get a homepage going! Time to create!
• Create: home.php
• Adding css to style.css
Updating A Footer
Want to get rid of someone’s copyright? :-)
• Modify: footer.php
• Adding css to style.css
The Sidebar
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;
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.
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
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' ); ?>

Contenu connexe

Tendances

Meetup child-themes
Meetup child-themesMeetup child-themes
Meetup child-themes
DaisyOlsen
 
Theme frameworks & child themes
Theme frameworks & child themesTheme frameworks & child themes
Theme frameworks & child themes
Chris Olbekson
 

Tendances (19)

Meetup child-themes
Meetup child-themesMeetup child-themes
Meetup child-themes
 
Installing WordPress The Right Way
Installing WordPress The Right WayInstalling WordPress The Right Way
Installing WordPress The Right Way
 
Custom Menu Support for WordPress Themes
Custom Menu Support for WordPress ThemesCustom Menu Support for WordPress Themes
Custom Menu Support for WordPress Themes
 
Meetup child-themes
Meetup child-themesMeetup child-themes
Meetup child-themes
 
Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)
 
WP 101 - Custom Fields & Post Types
WP 101 - Custom Fields & Post TypesWP 101 - Custom Fields & Post Types
WP 101 - Custom Fields & Post Types
 
Web 101 intro to html
Web 101  intro to htmlWeb 101  intro to html
Web 101 intro to html
 
WordPress 101
WordPress 101WordPress 101
WordPress 101
 
WP 101 - WordPress Basics
WP 101 - WordPress BasicsWP 101 - WordPress Basics
WP 101 - WordPress Basics
 
The Basics of WordPress
The Basics of WordPressThe Basics of WordPress
The Basics of WordPress
 
What Is WordPress and Why Should I Use It? - Workshop April 2015
What Is WordPress and Why Should I Use It? - Workshop April 2015What Is WordPress and Why Should I Use It? - Workshop April 2015
What Is WordPress and Why Should I Use It? - Workshop April 2015
 
Cain & Obenland — Episode 4
Cain & Obenland — Episode 4Cain & Obenland — Episode 4
Cain & Obenland — Episode 4
 
WordPress Meetup Bandung - December 2014
WordPress Meetup Bandung - December 2014WordPress Meetup Bandung - December 2014
WordPress Meetup Bandung - December 2014
 
Introduction to WordPress Child Themes
Introduction to WordPress Child ThemesIntroduction to WordPress Child Themes
Introduction to WordPress Child Themes
 
WordPress best practices by billrice
WordPress best practices by billriceWordPress best practices by billrice
WordPress best practices by billrice
 
W pthemes
W pthemesW pthemes
W pthemes
 
Basic WordPress SEO
Basic WordPress SEOBasic WordPress SEO
Basic WordPress SEO
 
Thinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSSThinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSS
 
Theme frameworks & child themes
Theme frameworks & child themesTheme frameworks & child themes
Theme frameworks & child themes
 

Similaire à WordPress Theme Workshop: Part 4

Theme development essentials columbus oh word camp 2012
Theme development essentials   columbus oh word camp 2012Theme development essentials   columbus oh word camp 2012
Theme development essentials columbus oh word camp 2012
Joe Querin
 

Similaire à WordPress Theme Workshop: Part 4 (20)

WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3
 
Customizing WordPress Themes
Customizing WordPress ThemesCustomizing WordPress Themes
Customizing WordPress Themes
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme Enlightenment
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017
 
How to make a WordPress theme
How to make a WordPress themeHow to make a WordPress theme
How to make a WordPress theme
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
 
Theme development essentials columbus oh word camp 2012
Theme development essentials   columbus oh word camp 2012Theme development essentials   columbus oh word camp 2012
Theme development essentials columbus oh word camp 2012
 
WordPress Theme Design - Rich Media Institute Workshop
WordPress Theme Design - Rich Media Institute WorkshopWordPress Theme Design - Rich Media Institute Workshop
WordPress Theme Design - Rich Media Institute Workshop
 
Theming 101
Theming 101Theming 101
Theming 101
 
Responsive Theme Workshop - WordCamp Columbus 2015
Responsive Theme Workshop - WordCamp Columbus 2015Responsive Theme Workshop - WordCamp Columbus 2015
Responsive Theme Workshop - WordCamp Columbus 2015
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Theme
 
WordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media InstituteWordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media Institute
 
Builing a WordPress Theme
Builing a WordPress ThemeBuiling a WordPress Theme
Builing a WordPress Theme
 
WordPress Theming 101
WordPress Theming 101WordPress Theming 101
WordPress Theming 101
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
 
Newbies guide to customizing word press themes 25
Newbies guide to customizing word press themes 25Newbies guide to customizing word press themes 25
Newbies guide to customizing word press themes 25
 
Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016
 
PSD to WordPress
PSD to WordPressPSD to WordPress
PSD to WordPress
 
Grok Drupal (7) Theming - 2011 Feb update
Grok Drupal (7) Theming - 2011 Feb updateGrok Drupal (7) Theming - 2011 Feb update
Grok Drupal (7) Theming - 2011 Feb update
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme Development
 

Plus de David Bisset

WordCamp Tampa 2015
WordCamp Tampa 2015WordCamp Tampa 2015
WordCamp Tampa 2015
David Bisset
 
WPSessions - Thinking Outside The Box With BuddyPress
WPSessions - Thinking Outside The Box With BuddyPressWPSessions - Thinking Outside The Box With BuddyPress
WPSessions - Thinking Outside The Box With BuddyPress
David Bisset
 

Plus de David Bisset (20)

WordPress Theme Workshop: Part 2
WordPress Theme Workshop: Part 2WordPress Theme Workshop: Part 2
WordPress Theme Workshop: Part 2
 
WordPress Theme Workshop: Customizer
WordPress Theme Workshop: CustomizerWordPress Theme Workshop: Customizer
WordPress Theme Workshop: Customizer
 
WordPress Theme Workshop: CSS/JS
WordPress Theme Workshop: CSS/JSWordPress Theme Workshop: CSS/JS
WordPress Theme Workshop: CSS/JS
 
WordPress Theme Workshop: Internationalization
WordPress Theme Workshop: InternationalizationWordPress Theme Workshop: Internationalization
WordPress Theme Workshop: Internationalization
 
WordPress Theme Workshop: Misc
WordPress Theme Workshop: MiscWordPress Theme Workshop: Misc
WordPress Theme Workshop: Misc
 
WordPress Theme Workshop: Widgets
WordPress Theme Workshop: WidgetsWordPress Theme Workshop: Widgets
WordPress Theme Workshop: Widgets
 
WordPress Theme Workshop: Menus
WordPress Theme Workshop: MenusWordPress Theme Workshop: Menus
WordPress Theme Workshop: Menus
 
WordPress Theme Workshop: Sidebars
WordPress Theme Workshop: SidebarsWordPress Theme Workshop: Sidebars
WordPress Theme Workshop: Sidebars
 
WordPress Theme Workshop: Theme Setup
WordPress Theme Workshop: Theme SetupWordPress Theme Workshop: Theme Setup
WordPress Theme Workshop: Theme Setup
 
BuddyPress & Higher Education
BuddyPress & Higher EducationBuddyPress & Higher Education
BuddyPress & Higher Education
 
WordPress Meetup (Davie, FL) - Top 9 April 2016
WordPress Meetup (Davie, FL) - Top 9 April 2016WordPress Meetup (Davie, FL) - Top 9 April 2016
WordPress Meetup (Davie, FL) - Top 9 April 2016
 
WordCamp Tampa 2015
WordCamp Tampa 2015WordCamp Tampa 2015
WordCamp Tampa 2015
 
BuddyPress v4
BuddyPress v4BuddyPress v4
BuddyPress v4
 
WPSessions - Thinking Outside The Box With BuddyPress
WPSessions - Thinking Outside The Box With BuddyPressWPSessions - Thinking Outside The Box With BuddyPress
WPSessions - Thinking Outside The Box With BuddyPress
 
SunShine PHP
SunShine PHPSunShine PHP
SunShine PHP
 
Building Next Generation Applications With BuddyPress
Building Next Generation Applications With BuddyPressBuilding Next Generation Applications With BuddyPress
Building Next Generation Applications With BuddyPress
 
Be a Part of Something Bigger: Get Involved with WordPress
Be a Part of Something Bigger: Get Involved with WordPressBe a Part of Something Bigger: Get Involved with WordPress
Be a Part of Something Bigger: Get Involved with WordPress
 
WordPress Meetup - Top 9 September 2015
WordPress Meetup - Top 9 September 2015WordPress Meetup - Top 9 September 2015
WordPress Meetup - Top 9 September 2015
 
WordPress Miami Meetup: Top 9 (August 2015)
WordPress Miami Meetup: Top 9 (August 2015)WordPress Miami Meetup: Top 9 (August 2015)
WordPress Miami Meetup: Top 9 (August 2015)
 
Getting Started With Grunt for WordPress Development
Getting Started With Grunt for WordPress DevelopmentGetting Started With Grunt for WordPress Development
Getting Started With Grunt for WordPress Development
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

WordPress Theme Workshop: Part 4

  • 1. WordPress Theme Workshop: Part 4 November 4th, 2017 David Bisset davidbisset.com / @dimensionmedia
  • 3. Creating A Homepage Let’s just get a homepage going! Time to create! • Create: home.php • Adding css to style.css
  • 4. Updating A Footer Want to get rid of someone’s copyright? :-) • Modify: footer.php • Adding css to style.css
  • 5. The Sidebar 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;
  • 6. 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)
  • 7. 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.
  • 8. Download And Install _s Theme http://underscores.me/
  • 9. Download And Install _s Theme http://underscores.me/
  • 10. Why Is It Blank? No Screenshot.png http://underscores.me/
  • 11. 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.
  • 12. Looking At _S Theme Structure
  • 13. 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;
  • 14. 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.
  • 15. 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!
  • 17. 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>
  • 19. 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>
  • 20. 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
  • 21. 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
  • 22. 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
  • 23. 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.
  • 24. The WordPress “Loop” <?php get_header(); if (have_posts()) : while (have_posts()) : the_post(); the_content(); endwhile; endif; get_sidebar(); get_footer(); ?>
  • 25. The WordPress “Loop” <?php get_header(); if (have_posts()) : while (have_posts()) : the_post(); the_content(); endwhile; endif; get_sidebar(); get_footer(); ?>
  • 26. 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.
  • 27. 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(); ?>
  • 28. 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();
  • 29. _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();