SlideShare une entreprise Scribd logo
1  sur  26
FRAMEWORKS, PARENTS & CHILDREN
• Parent Theme
• A base theme that sets up functionality
• Can be extended
• Must be written to allow overrides
• Child Theme
• Extends a parent theme
• Can carry over or override elements from parent
• Cannot be extended without plugins
• Framework
• Not a full theme; more of a plugin for a theme
• Allows creation of parent and child themes with shared functionality
http://justintadlock.com/archives/2010/08/16/frameworks-parent-child-and-grandchild-themes
EXAMPLES
Hybrid Core is a framework. - http://themehybrid.com/hybrid-core
• No theme structure
• Full package goes inside parent theme
Genesis “Framework” is a parent theme -
http://www.studiopress.com/features
• Has a theme structure
• Can be used on its own
• Does not go inside of another theme
TwentyTwelve is a parent theme -
http://wordpress.org/extend/themes/twentytwelve
• Although it has less of a framework built in, same concept as Genesis
“Education” is a child theme - http://my.studiopress.com/themes/education/
• Cannot be used without Genesis (parent theme) installed
REQUIRED FILES
CSS Stylesheet (style.css)*
• Implements the CSS for the theme
• Not included by default
• enqueue it in functions.php or
• use <link href=“<?php bloginfo( „stylesheet_uri‟ ) ?>”/> in <head>
• Provides base information about the theme
• Theme name, URI, version, license, etc.
(http://codex.wordpress.org/Theme_Development#Theme_Stylesheet)
Index (index.php)
• Implements the structure of the theme
• Can be split out into multiple files
• Acts as fallback for all pages**
* - style.css is the only file required in a child theme; all others fallback to parent theme
** - the Template Hierarchy governs which files are used for each page; index is the final fallback
TYPICAL THEME FILES
Theme Functions (functions.php)
• Central location for function, variable, constant defintions used in theme
• Included automatically by theme engine before after_setup_theme action
Default Sidebar (sidebar.php)
• Outputs default sidebar (get_sidebar())
Default WordPress Loop (loop.php)
• Not included automatically by theme
• Used to separate “the loop”*** from other structure
Comments Template (comments.php)
• List of comments and comment form; use comments_template() to include
Search (search.php)
• Search results template; automatically used on search results page
MOAR THEME FILES
Automatic Template Files (page.php, 404.php, single.php)
• Used automatically based on type of page being shown;
• Overrides index.php (see the Template Hierarchy)
Miscellaneous Files (sidebar-[slug].php, etc.)
• Include with the get_template_part( „sidebar‟, „[slug]‟ ) function
• Sidebar, header and footer files can be included with:
• get_sidebar( ‘[slug]’ )
• get_header( ‘[slug]’ )
• get_footer( ‘[slug]’ )
Header and Footer (header.php, footer.php)
• Not included automatically
• Call with get_header() & get_footer()
THE WORDPRESS TEMPLATE HIERARCHY
WordPress automatically searches for appropriate theme template file
WHAT IS “THE LOOP”?
The Loop outputs the main content area
• Loops through all matching content objects
if ( have_posts() ) : while ( have_posts() ) : the_post();
// Output all of your content
endwhile; endif;
have_posts() and the_post()
• Global methods of main query object ($wp_query)
• have_posts() generates array of “post” objects
• the_post() sets global variables related to current post object
OTHER “LOOP” FUNCTIONS
Inside the loop, various functions are available
• the_title() – echoes the title of the current post
• the_content() – echoes the body of the current post
• the_post_thumbnail() – echoes the “featured image” for current post
MOAR LOOP TIPS
If you need to use the same query loop more than once:
• Use rewind_posts() to reset the loop to be used again
You can start your own loop with a custom query:
$myquery = new WP_Query( ‘[query parameters go here]’ );
if ( $myquery->have_posts() ) : while ( $myquery-
>have_posts() ) : $myquery->the_post();
// Your custom loop stuff here
endwhile; endif;
• Don’t alter the global $wp_query or use query_posts() unless you know
what you’re doing
• Use get_posts() or create your own loop, instead
USING CONDITIONAL FUNCTIONS
Identify where you are:
• is_home() – on the default home page (or the “posts” page if set in Settings)
• is_front_page() – on the static front page (set in Settings)
• is_admin() / is_network_admin() – anywhere in the admin area (not on the login
page)
• is_single() / is_page() / is_attachment() / is_singular( $post_type ) –single
content entry
• is_post_type_archive() – a list of content entries from a specific content type
• is_category() / is_tag() / is_tax() – a list of content entries with a specific
taxonomy
• is_404() – a non-existent page
• is_search() – showing the list of search results
• is_feed() – is a structured feed (RSS, Atom, etc.)
TESTING CONDITIONS
Not just where you are, but what features are available:
• has_post_thumbnail() – whether or not the “featured image” is set
• has_excerpt() – whether a manual excerpt is set for the content
• is_active_sidebar() – whether a widgetized area (“sidebar”) has any widgets
• has_nav_menu() – whether a custom menu location has a menu assigned
• is_multisite() – whether the site is part of a multisite network
• is_plugin_active() – whether a specific plugin is active on the site
• wp_script_is() & wp_style_is() – whether a script/stylesheet has been
registered, enqueued, printed, etc.
MAPPING IT OUT
• Choose what to build
• Full theme
• Child theme – only requires style.css; all others are optional
• Theme based on framework – requirements differ based on framework
• Fulfill requirements
• style.css
• wp_head()
• wp_footer()
• http://j.mp/140mlRU
• Install and test it
• Don‟t be afraid to split things out; use get_template_part() to include
additional theme pieces
STEP 1: DESIGN
• Identify goals
• Wireframe and design
• Layout priorities
• Final template design
• Initial HTML layout
STEP 2: DIVIDE AND CONQUER
• Identify layout elements
• Identify content elements
• Identify visual decoration
• Determine common elements
• Identify alternative layouts
STEP 3: DEVELOP
• Begin developing basic layout
• Separate layout elements from
content elements
• Replace content elements with
placeholders
• Create layout structure and style
• Develop content containers
(body, widgets, footer, header, et
c.)
• Develop custom functionality
QUESTIONS? COMMENTS?
Twitter: @cgrymala
Website(s): http://umw.edu/ (Multi-Network Setup)
http://ten-321.com/
http://svn.ten-321.com/ (SVN Repo)
http://wphighed.org/ (WP resources for Higher Ed)
Email: cgrymala@umw.edu
curtiss@ten-321.com
SpeakerRate: http://spkr8.com/s/10608
http://about.me/cgrymala

Contenu connexe

Tendances

How to get your theme in WordPress
How to get your theme in WordPressHow to get your theme in WordPress
How to get your theme in WordPress
Nisha Singh
 
Theming moodle technical
Theming moodle   technicalTheming moodle   technical
Theming moodle technical
Alex Walker
 
Anatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress ThemeAnatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress Theme
Julie Kuehl
 
Things I Wish I Had Known Before Developing a WordPress Theme
Things I Wish I Had Known Before Developing a WordPress ThemeThings I Wish I Had Known Before Developing a WordPress Theme
Things I Wish I Had Known Before Developing a WordPress Theme
Konstantin Kovshenin
 

Tendances (20)

Creating Landing Pages and Layouts for Drupal 8 - DrupalCon Baltimore
Creating Landing Pages and Layouts for Drupal 8 - DrupalCon BaltimoreCreating Landing Pages and Layouts for Drupal 8 - DrupalCon Baltimore
Creating Landing Pages and Layouts for Drupal 8 - DrupalCon Baltimore
 
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 ThemeMinimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
 
Creating a Reusable Drupal Website for Higher Education - Webinar
Creating a Reusable Drupal Website for Higher Education - WebinarCreating a Reusable Drupal Website for Higher Education - Webinar
Creating a Reusable Drupal Website for Higher Education - Webinar
 
Creating a Reusable Drupal Website for Higher Education - at USG Tech Day
Creating a Reusable Drupal Website for Higher Education - at USG Tech DayCreating a Reusable Drupal Website for Higher Education - at USG Tech Day
Creating a Reusable Drupal Website for Higher Education - at USG Tech Day
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First Steps
 
How to get your theme in WordPress
How to get your theme in WordPressHow to get your theme in WordPress
How to get your theme in WordPress
 
10 Steps Not To Forget After Installing Drupal
10 Steps Not To Forget After Installing Drupal 10 Steps Not To Forget After Installing Drupal
10 Steps Not To Forget After Installing Drupal
 
YAG - Yet Another Gallery / T3CON11
YAG - Yet Another Gallery / T3CON11YAG - Yet Another Gallery / T3CON11
YAG - Yet Another Gallery / T3CON11
 
Turbo charged WordPress theme development - WordCamp Edinburgh 2012
Turbo charged WordPress theme development - WordCamp Edinburgh 2012Turbo charged WordPress theme development - WordCamp Edinburgh 2012
Turbo charged WordPress theme development - WordCamp Edinburgh 2012
 
YAG - Yet Another Gallery
YAG - Yet Another GalleryYAG - Yet Another Gallery
YAG - Yet Another Gallery
 
Theming moodle technical
Theming moodle   technicalTheming moodle   technical
Theming moodle technical
 
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon DublinCreating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
 
A Custom Drupal Theme in 40 Minutes
A Custom Drupal Theme in 40 MinutesA Custom Drupal Theme in 40 Minutes
A Custom Drupal Theme in 40 Minutes
 
Crash Course in Theme Surgery
Crash Course in Theme SurgeryCrash Course in Theme Surgery
Crash Course in Theme Surgery
 
Theme Development: From an idea to getting approved to wordpress.org
Theme Development: From an idea to getting approved to wordpress.orgTheme Development: From an idea to getting approved to wordpress.org
Theme Development: From an idea to getting approved to wordpress.org
 
Anatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress ThemeAnatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress Theme
 
Wordpress beyond blogging
Wordpress beyond bloggingWordpress beyond blogging
Wordpress beyond blogging
 
Things I Wish I Had Known Before Developing a WordPress Theme
Things I Wish I Had Known Before Developing a WordPress ThemeThings I Wish I Had Known Before Developing a WordPress Theme
Things I Wish I Had Known Before Developing a WordPress Theme
 
WordPress Template hierarchy
WordPress Template hierarchyWordPress Template hierarchy
WordPress Template hierarchy
 
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 ThemeCreating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
 

En vedette

Sanntidsdata i ArcGIS - Esri norsk BK 2014
Sanntidsdata i ArcGIS -  Esri norsk BK 2014Sanntidsdata i ArcGIS -  Esri norsk BK 2014
Sanntidsdata i ArcGIS - Esri norsk BK 2014
Geodata AS
 
Третій Zakupki Forum - Практичні кейси юридичного супроводу публічних закупівель
Третій Zakupki Forum - Практичні кейси юридичного супроводу публічних закупівельТретій Zakupki Forum - Практичні кейси юридичного супроводу публічних закупівель
Третій Zakupki Forum - Практичні кейси юридичного супроводу публічних закупівель
Zakupki.Prom.ua
 
Презентація "Надихаю дихати"
Презентація "Надихаю дихати"Презентація "Надихаю дихати"
Презентація "Надихаю дихати"
Andrii Bas
 

En vedette (20)

E-Waste
E-WasteE-Waste
E-Waste
 
Boost
BoostBoost
Boost
 
Sanntidsdata i ArcGIS - Esri norsk BK 2014
Sanntidsdata i ArcGIS -  Esri norsk BK 2014Sanntidsdata i ArcGIS -  Esri norsk BK 2014
Sanntidsdata i ArcGIS - Esri norsk BK 2014
 
Третій Zakupki Forum - Практичні кейси юридичного супроводу публічних закупівель
Третій Zakupki Forum - Практичні кейси юридичного супроводу публічних закупівельТретій Zakupki Forum - Практичні кейси юридичного супроводу публічних закупівель
Третій Zakupki Forum - Практичні кейси юридичного супроводу публічних закупівель
 
เล่ม 2 สมการเคมี
เล่ม 2 สมการเคมีเล่ม 2 สมการเคมี
เล่ม 2 สมการเคมี
 
Taseer e aza
Taseer e azaTaseer e aza
Taseer e aza
 
AYMANALSUHET CV2017
AYMANALSUHET CV2017AYMANALSUHET CV2017
AYMANALSUHET CV2017
 
ayman3
ayman3ayman3
ayman3
 
Nota VLE
Nota VLENota VLE
Nota VLE
 
Hypersensitivity
HypersensitivityHypersensitivity
Hypersensitivity
 
Sociala Medier i Statens Tjänst Informationsföreningen 20100121
Sociala Medier i Statens Tjänst Informationsföreningen 20100121Sociala Medier i Statens Tjänst Informationsföreningen 20100121
Sociala Medier i Statens Tjänst Informationsföreningen 20100121
 
Storyboards
StoryboardsStoryboards
Storyboards
 
Mercado Inmobiliario de Barcelona T1 & T2 2013
Mercado Inmobiliario de Barcelona T1 & T2 2013Mercado Inmobiliario de Barcelona T1 & T2 2013
Mercado Inmobiliario de Barcelona T1 & T2 2013
 
รายงานประจำปี คณะศึกษาศาสตร์ Draft#1
รายงานประจำปี คณะศึกษาศาสตร์ Draft#1รายงานประจำปี คณะศึกษาศาสตร์ Draft#1
รายงานประจำปี คณะศึกษาศาสตร์ Draft#1
 
Презентація "Надихаю дихати"
Презентація "Надихаю дихати"Презентація "Надихаю дихати"
Презентація "Надихаю дихати"
 
Наглядный индекс развития сетевых технологий
Наглядный индекс развития сетевых технологийНаглядный индекс развития сетевых технологий
Наглядный индекс развития сетевых технологий
 
MDChronic
MDChronicMDChronic
MDChronic
 
The Lean Investor: Lots of Little Bets (Boston, Dec 2014)
The Lean Investor: Lots of Little Bets (Boston, Dec 2014)The Lean Investor: Lots of Little Bets (Boston, Dec 2014)
The Lean Investor: Lots of Little Bets (Boston, Dec 2014)
 
Welcome to Ahmadiyyat, The True Islam
Welcome to Ahmadiyyat,  The True Islam Welcome to Ahmadiyyat,  The True Islam
Welcome to Ahmadiyyat, The True Islam
 
ITB FNBE Overall exercise
ITB FNBE Overall exerciseITB FNBE Overall exercise
ITB FNBE Overall exercise
 

Similaire à WordPress Themes 101 - PSUWeb13 Workshop

Drupal Step-by-Step: How We Built Our Training Site, Part 2
Drupal Step-by-Step: How We Built Our Training Site, Part 2Drupal Step-by-Step: How We Built Our Training Site, Part 2
Drupal Step-by-Step: How We Built Our Training Site, Part 2
Acquia
 
WCLV - Introduction to child themes
WCLV - Introduction to child themesWCLV - Introduction to child themes
WCLV - Introduction to child themes
vegasgeek
 
WordPress Child Themes
WordPress Child ThemesWordPress Child Themes
WordPress Child Themes
openchamp
 
The WordPress University
The WordPress UniversityThe WordPress University
The WordPress University
Stephanie Leary
 

Similaire à WordPress Themes 101 - PSUWeb13 Workshop (20)

The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme Enlightenment
 
Wordpress theme development
Wordpress theme developmentWordpress theme development
Wordpress theme development
 
Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?
 
Intro to WordPress theme development
Intro to WordPress theme developmentIntro to WordPress theme development
Intro to WordPress theme development
 
What's New in WordPress 3.0 (for developers)
What's New in WordPress 3.0 (for developers)What's New in WordPress 3.0 (for developers)
What's New in WordPress 3.0 (for developers)
 
Basic word press development
Basic word press developmentBasic word press development
Basic word press development
 
Design todevelop
Design todevelopDesign todevelop
Design todevelop
 
Intro to WordPress Child Themes (NERDS Sept 2014)
Intro to WordPress Child Themes (NERDS Sept 2014)Intro to WordPress Child Themes (NERDS Sept 2014)
Intro to WordPress Child Themes (NERDS Sept 2014)
 
Drupal Step-by-Step: How We Built Our Training Site, Part 2
Drupal Step-by-Step: How We Built Our Training Site, Part 2Drupal Step-by-Step: How We Built Our Training Site, Part 2
Drupal Step-by-Step: How We Built Our Training Site, Part 2
 
WCLV - Introduction to child themes
WCLV - Introduction to child themesWCLV - Introduction to child themes
WCLV - Introduction to child themes
 
Drupal theming - a practical approach (European Drupal Days 2015)
Drupal theming - a practical approach (European Drupal Days 2015)Drupal theming - a practical approach (European Drupal Days 2015)
Drupal theming - a practical approach (European Drupal Days 2015)
 
Seven deadly theming sins
Seven deadly theming sinsSeven deadly theming sins
Seven deadly theming sins
 
WordPress Child Themes
WordPress Child ThemesWordPress Child Themes
WordPress Child Themes
 
WP Joburg Meetup 10: Genesis Framework by Trish Cornelius
WP Joburg Meetup 10: Genesis Framework by Trish CorneliusWP Joburg Meetup 10: Genesis Framework by Trish Cornelius
WP Joburg Meetup 10: Genesis Framework by Trish Cornelius
 
The WordPress University
The WordPress UniversityThe WordPress University
The WordPress University
 
Adopt or hack - how to hack a theme in a Drupal way
Adopt or hack - how to hack a theme in a Drupal wayAdopt or hack - how to hack a theme in a Drupal way
Adopt or hack - how to hack a theme in a Drupal way
 
full-site-editing-theme-presentation.pptx
full-site-editing-theme-presentation.pptxfull-site-editing-theme-presentation.pptx
full-site-editing-theme-presentation.pptx
 
Responsive Theme Workshop - WordCamp Columbus 2015
Responsive Theme Workshop - WordCamp Columbus 2015Responsive Theme Workshop - WordCamp Columbus 2015
Responsive Theme Workshop - WordCamp Columbus 2015
 
Child Themes and CSS in WordPress
Child Themes and CSS in WordPressChild Themes and CSS in WordPress
Child Themes and CSS in WordPress
 

Plus de Curtiss Grymala

10 Minute WordPress Shortcode
10 Minute WordPress Shortcode10 Minute WordPress Shortcode
10 Minute WordPress Shortcode
Curtiss Grymala
 
Writing a WordPress Plugin
Writing a WordPress PluginWriting a WordPress Plugin
Writing a WordPress Plugin
Curtiss Grymala
 
WordPress Coding Standards
WordPress Coding StandardsWordPress Coding Standards
WordPress Coding Standards
Curtiss Grymala
 

Plus de Curtiss Grymala (8)

WordPress as a CMS
WordPress as a CMSWordPress as a CMS
WordPress as a CMS
 
WordPress in HigherEd
WordPress in HigherEdWordPress in HigherEd
WordPress in HigherEd
 
Umw WordPress Primer
Umw WordPress PrimerUmw WordPress Primer
Umw WordPress Primer
 
Writing a WordPress Plugin: #heweb12
Writing a WordPress Plugin: #heweb12Writing a WordPress Plugin: #heweb12
Writing a WordPress Plugin: #heweb12
 
10 Minute WordPress Shortcode
10 Minute WordPress Shortcode10 Minute WordPress Shortcode
10 Minute WordPress Shortcode
 
Writing a WordPress Plugin
Writing a WordPress PluginWriting a WordPress Plugin
Writing a WordPress Plugin
 
WordPress Coding Standards
WordPress Coding StandardsWordPress Coding Standards
WordPress Coding Standards
 
WordPress Multi-Network
WordPress Multi-NetworkWordPress Multi-Network
WordPress Multi-Network
 

Dernier

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Dernier (20)

Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 

WordPress Themes 101 - PSUWeb13 Workshop

  • 1.
  • 2.
  • 3.
  • 4. FRAMEWORKS, PARENTS & CHILDREN • Parent Theme • A base theme that sets up functionality • Can be extended • Must be written to allow overrides • Child Theme • Extends a parent theme • Can carry over or override elements from parent • Cannot be extended without plugins • Framework • Not a full theme; more of a plugin for a theme • Allows creation of parent and child themes with shared functionality http://justintadlock.com/archives/2010/08/16/frameworks-parent-child-and-grandchild-themes
  • 5. EXAMPLES Hybrid Core is a framework. - http://themehybrid.com/hybrid-core • No theme structure • Full package goes inside parent theme Genesis “Framework” is a parent theme - http://www.studiopress.com/features • Has a theme structure • Can be used on its own • Does not go inside of another theme TwentyTwelve is a parent theme - http://wordpress.org/extend/themes/twentytwelve • Although it has less of a framework built in, same concept as Genesis “Education” is a child theme - http://my.studiopress.com/themes/education/ • Cannot be used without Genesis (parent theme) installed
  • 6.
  • 7. REQUIRED FILES CSS Stylesheet (style.css)* • Implements the CSS for the theme • Not included by default • enqueue it in functions.php or • use <link href=“<?php bloginfo( „stylesheet_uri‟ ) ?>”/> in <head> • Provides base information about the theme • Theme name, URI, version, license, etc. (http://codex.wordpress.org/Theme_Development#Theme_Stylesheet) Index (index.php) • Implements the structure of the theme • Can be split out into multiple files • Acts as fallback for all pages** * - style.css is the only file required in a child theme; all others fallback to parent theme ** - the Template Hierarchy governs which files are used for each page; index is the final fallback
  • 8. TYPICAL THEME FILES Theme Functions (functions.php) • Central location for function, variable, constant defintions used in theme • Included automatically by theme engine before after_setup_theme action Default Sidebar (sidebar.php) • Outputs default sidebar (get_sidebar()) Default WordPress Loop (loop.php) • Not included automatically by theme • Used to separate “the loop”*** from other structure Comments Template (comments.php) • List of comments and comment form; use comments_template() to include Search (search.php) • Search results template; automatically used on search results page
  • 9. MOAR THEME FILES Automatic Template Files (page.php, 404.php, single.php) • Used automatically based on type of page being shown; • Overrides index.php (see the Template Hierarchy) Miscellaneous Files (sidebar-[slug].php, etc.) • Include with the get_template_part( „sidebar‟, „[slug]‟ ) function • Sidebar, header and footer files can be included with: • get_sidebar( ‘[slug]’ ) • get_header( ‘[slug]’ ) • get_footer( ‘[slug]’ ) Header and Footer (header.php, footer.php) • Not included automatically • Call with get_header() & get_footer()
  • 10.
  • 11. THE WORDPRESS TEMPLATE HIERARCHY WordPress automatically searches for appropriate theme template file
  • 12.
  • 13. WHAT IS “THE LOOP”? The Loop outputs the main content area • Loops through all matching content objects if ( have_posts() ) : while ( have_posts() ) : the_post(); // Output all of your content endwhile; endif; have_posts() and the_post() • Global methods of main query object ($wp_query) • have_posts() generates array of “post” objects • the_post() sets global variables related to current post object
  • 14. OTHER “LOOP” FUNCTIONS Inside the loop, various functions are available • the_title() – echoes the title of the current post • the_content() – echoes the body of the current post • the_post_thumbnail() – echoes the “featured image” for current post
  • 15. MOAR LOOP TIPS If you need to use the same query loop more than once: • Use rewind_posts() to reset the loop to be used again You can start your own loop with a custom query: $myquery = new WP_Query( ‘[query parameters go here]’ ); if ( $myquery->have_posts() ) : while ( $myquery- >have_posts() ) : $myquery->the_post(); // Your custom loop stuff here endwhile; endif; • Don’t alter the global $wp_query or use query_posts() unless you know what you’re doing • Use get_posts() or create your own loop, instead
  • 16.
  • 17. USING CONDITIONAL FUNCTIONS Identify where you are: • is_home() – on the default home page (or the “posts” page if set in Settings) • is_front_page() – on the static front page (set in Settings) • is_admin() / is_network_admin() – anywhere in the admin area (not on the login page) • is_single() / is_page() / is_attachment() / is_singular( $post_type ) –single content entry • is_post_type_archive() – a list of content entries from a specific content type • is_category() / is_tag() / is_tax() – a list of content entries with a specific taxonomy • is_404() – a non-existent page • is_search() – showing the list of search results • is_feed() – is a structured feed (RSS, Atom, etc.)
  • 18. TESTING CONDITIONS Not just where you are, but what features are available: • has_post_thumbnail() – whether or not the “featured image” is set • has_excerpt() – whether a manual excerpt is set for the content • is_active_sidebar() – whether a widgetized area (“sidebar”) has any widgets • has_nav_menu() – whether a custom menu location has a menu assigned • is_multisite() – whether the site is part of a multisite network • is_plugin_active() – whether a specific plugin is active on the site • wp_script_is() & wp_style_is() – whether a script/stylesheet has been registered, enqueued, printed, etc.
  • 19.
  • 20. MAPPING IT OUT • Choose what to build • Full theme • Child theme – only requires style.css; all others are optional • Theme based on framework – requirements differ based on framework • Fulfill requirements • style.css • wp_head() • wp_footer() • http://j.mp/140mlRU • Install and test it • Don‟t be afraid to split things out; use get_template_part() to include additional theme pieces
  • 21.
  • 22.
  • 23. STEP 1: DESIGN • Identify goals • Wireframe and design • Layout priorities • Final template design • Initial HTML layout
  • 24. STEP 2: DIVIDE AND CONQUER • Identify layout elements • Identify content elements • Identify visual decoration • Determine common elements • Identify alternative layouts
  • 25. STEP 3: DEVELOP • Begin developing basic layout • Separate layout elements from content elements • Replace content elements with placeholders • Create layout structure and style • Develop content containers (body, widgets, footer, header, et c.) • Develop custom functionality
  • 26. QUESTIONS? COMMENTS? Twitter: @cgrymala Website(s): http://umw.edu/ (Multi-Network Setup) http://ten-321.com/ http://svn.ten-321.com/ (SVN Repo) http://wphighed.org/ (WP resources for Higher Ed) Email: cgrymala@umw.edu curtiss@ten-321.com SpeakerRate: http://spkr8.com/s/10608 http://about.me/cgrymala