SlideShare a Scribd company logo
1 of 23
Download to read offline
How Does get_template_partHow Does get_template_partHow Does get_template_part
Works In Twenty Ten Theme
How Does get_template_part
Works In Twenty Ten Theme
By: Rozani Ghani
http://rozanighani.com/
What Exactly
GET_template_part is?
• get_template_part is used to load a template
part into a template (other than header,part into a template (other than header,
sidebar, footer)
• get_template_part is used for child theme
development but actually is not just for child
theme development only, is there more thantheme development only, is there more than
that.
Let See how GET_template_part
is originated?
• We see how get_template_part works.
• This example may vary with how developer• This example may vary with how developer
perception but this is just to illustrate how the
the get_template_part works.
• I use index.html as the very famous example.
• As a clear example, I use the index.php in• As a clear example, I use the index.php in
Twenty Ten Theme.
Index.html
• A wordpress index.html mostly consist of
these 4 basic template php files: header.php,these 4 basic template php files: header.php,
index.php, sidebar.php and also footer.php.
• I visualize these files in order to understand
get_template_part is.
How Does get_template_partHow Does get_template_partHow Does get_template_part
Works In Twenty Ten Theme
How Does get_template_part
Works In Twenty Ten Theme
By: Rozani Ghani http://rozanighani.com/
Header.php
Index.html
Index.php Sidebar.php
Footer.php
• We break the index.html into
the basic wordpress template
files.
Header.php
• We break the index.html into the basic wordpress template files. That is header.php,
index.php, sidebar.php and footer.php
Index.html
Index.php Sidebar.php
Footer.php
Header.php <?php get_header(); ?>
• We break the php into standard WordPress Codex tags.
Index.php Sidebar.php Index.php
<?php
get_sidebar();
?>
Footer.php <?php get_footer(); ?>
• Suppose there is a code to
replace index.php that is
How About index.php?
<?php get_header(); ?>
replace index.php that is
<?php get_index (); ?>
• After search in the
WordPress codex, <?php
get_index (); ?> is not exist.
• I prefer not to discuss
get_index because
Index.php
<?php
get_sidebar();
?>
get_index because
WordPress already done
stuff to make the index.php
working smoothly.
<?php get_footer(); ?>
Next…
• We going directly to get_template_part.
• But first, we going to understand this example.• But first, we going to understand this example.
• <?php get_template_part( $slug, $name ); ?>
• <?php get_template_part( 'loop', 'index' ); ?>
• What the heck are these?
What is $slug and $name?
• At the 1st sight, I don’t really understand what
$slug and $name are.$slug and $name are.
• But, I take them as these:
 $slug as $ parent
 $name as $child
• As I take them like that, it much easier to• As I take them like that, it much easier to
understand get_template_part and very much
of child theme
Recall…
• <?php get_template_part( $slug, $name ); ?>
can be written alsocan be written also
is <?php get_template_part( $slug ); ?>
• We going to convert those code such as
get_header into get_template_part (‘header’)
We going to convert those code such as get_header into
get_template_part (‘header’)
<?php
get_template_part(‘header’); ?>
<?php get_header(); ?>
<?php
get_template_part
(‘index’); ?>
<?php
get_template_
part(‘sidebar’)
; ?>
Index.php
<?php
get_sidebar();
?>
; ?>
<?php
get_template_part(‘footer’); ?>
<?php get_footer(); ?>
We can conclude that the get_template_part works like this.
<?php get_header(); ?>
<?php get_template_part(‘index’); ?> <?php get_sidebar(); ?>
<?php get_footer(); ?>
The real index.php of Twenty Ten Theme looks like this.
<?php get_header(); ?>
<div id="container">
<div id="content" role="main">
<?php get_template_part( 'loop', 'index' );?>
<?php get_sidebar(); ?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_footer(); ?>
Index.php of Twenty Ten Theme
• Its look this:
The index.php is using <?php• The index.php is using <?php
get_template_part (‘loop’, ‘index’); ?>
Why?
• <?php get_template_part (‘loop’, ‘index’); ?>
is used to load loop-index.php.is used to load loop-index.php.
• What if loop-index.php not exists?
• get_template_part will load loop.php
Back to $slug and $name
Coding Technically
• Codex:
File Rename Technically
• Codex:• Codex:
• <?php get_template_part(
$slug, $name ); ?>
• Example:
• <?php get_template_part(
'loop', 'index' ); ?>
• Codex:
• $slug-$name.php
• Example:
• loop-index.php
'loop', 'index' ); ?>
• must have “-” between
$slug and $name
Why $parent and $child?
• To me, it is easier to understand and not much
confused.confused.
• Back to loop-index.php, this file already a child
php file.
• If <?php get_template_part (‘loop’, ‘index’); ?>
try to load loop-index.php but it fail, it willtry to load loop-index.php but it fail, it will
load her parent php file which is loop.php
• Agree ?
How Does get_template_partHow Does get_template_partHow Does get_template_part
Works In Twenty Ten Theme
How Does get_template_part
Works In Twenty Ten Theme
By: Rozani Ghani http://rozanighani.com/
Another Example Much Similar
• If you have Twenty Ten Theme, you should the
the footer.php file. See this:the footer.php file. See this:
• Much prettier right? But it is for sidebar.
• That code will load sidebar-footer.php• That code will load sidebar-footer.php
sidebar-footer.php
• <?php get_sidebar( 'footer' );?>
• is similar to• is similar to
• <?php get_template_part ( 'footer' );?>
• Why?
• Look the php file which is sidebar-footer.php
• Revise back what you have learn.
How Does get_template_partHow Does get_template_partHow Does get_template_part
Works In Twenty Ten Theme
How Does get_template_part
Works In Twenty Ten Theme
By: Rozani Ghani http://rozanighani.com/

More Related Content

What's hot

Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Paul Bearne
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Themecertainstrings
 
Streamlining Your Template Structures When Building Themes
Streamlining Your Template Structures When Building ThemesStreamlining Your Template Structures When Building Themes
Streamlining Your Template Structures When Building ThemesCameron Jones
 
Entry-level PHP for WordPress
Entry-level PHP for WordPressEntry-level PHP for WordPress
Entry-level PHP for WordPresssprclldr
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginningAnis Ahmad
 
Writing Apps the Google-y Way
Writing Apps the Google-y WayWriting Apps the Google-y Way
Writing Apps the Google-y WayPamela Fox
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniternicdev
 
Stop Hacking WordPress, Start Working with it - Charly Leetham - WordCamp Syd...
Stop Hacking WordPress, Start Working with it - Charly Leetham - WordCamp Syd...Stop Hacking WordPress, Start Working with it - Charly Leetham - WordCamp Syd...
Stop Hacking WordPress, Start Working with it - Charly Leetham - WordCamp Syd...WordCamp Sydney
 
En story of cakephp2.0
En story of cakephp2.0En story of cakephp2.0
En story of cakephp2.0Hiroki Shimizu
 
Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Stephan Hochdörfer
 
Creating Customizable Widgets for Unpredictable Needs
Creating Customizable Widgets for Unpredictable NeedsCreating Customizable Widgets for Unpredictable Needs
Creating Customizable Widgets for Unpredictable NeedsAmanda Giles
 

What's hot (20)

Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Theme
 
Streamlining Your Template Structures When Building Themes
Streamlining Your Template Structures When Building ThemesStreamlining Your Template Structures When Building Themes
Streamlining Your Template Structures When Building Themes
 
Stanford Html5talk
Stanford Html5talkStanford Html5talk
Stanford Html5talk
 
The Loop
The LoopThe Loop
The Loop
 
Wordpress & HTML5 by Rob Larsen
Wordpress & HTML5 by Rob LarsenWordpress & HTML5 by Rob Larsen
Wordpress & HTML5 by Rob Larsen
 
Entry-level PHP for WordPress
Entry-level PHP for WordPressEntry-level PHP for WordPress
Entry-level PHP for WordPress
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
A Phing fairy tale - ConFoo13
A Phing fairy tale - ConFoo13A Phing fairy tale - ConFoo13
A Phing fairy tale - ConFoo13
 
Writing Apps the Google-y Way
Writing Apps the Google-y WayWriting Apps the Google-y Way
Writing Apps the Google-y Way
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter
 
สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1
 
Stop Hacking WordPress, Start Working with it - Charly Leetham - WordCamp Syd...
Stop Hacking WordPress, Start Working with it - Charly Leetham - WordCamp Syd...Stop Hacking WordPress, Start Working with it - Charly Leetham - WordCamp Syd...
Stop Hacking WordPress, Start Working with it - Charly Leetham - WordCamp Syd...
 
Word Camp Fukuoka2010
Word Camp Fukuoka2010Word Camp Fukuoka2010
Word Camp Fukuoka2010
 
I Love codeigniter, You?
I Love codeigniter, You?I Love codeigniter, You?
I Love codeigniter, You?
 
En story of cakephp2.0
En story of cakephp2.0En story of cakephp2.0
En story of cakephp2.0
 
HTML 5 Basics Part One
HTML 5 Basics Part OneHTML 5 Basics Part One
HTML 5 Basics Part One
 
Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13
 
Creating Customizable Widgets for Unpredictable Needs
Creating Customizable Widgets for Unpredictable NeedsCreating Customizable Widgets for Unpredictable Needs
Creating Customizable Widgets for Unpredictable Needs
 
Theming 101
Theming 101Theming 101
Theming 101
 

Viewers also liked

Progamme XKE Janvier 2012
Progamme XKE Janvier 2012Progamme XKE Janvier 2012
Progamme XKE Janvier 2012bguerout
 
100 tips for building and maintaining a successful blog
100 tips for building and maintaining a successful blog100 tips for building and maintaining a successful blog
100 tips for building and maintaining a successful blogThe Customize Windows
 
salkdjfhdjkghdfkjh
salkdjfhdjkghdfkjhsalkdjfhdjkghdfkjh
salkdjfhdjkghdfkjhelodiaevie
 
App211 techdays 2013 Windows 8 concevoir des applications efficaces et perfor...
App211 techdays 2013 Windows 8 concevoir des applications efficaces et perfor...App211 techdays 2013 Windows 8 concevoir des applications efficaces et perfor...
App211 techdays 2013 Windows 8 concevoir des applications efficaces et perfor...Guillaume Brout
 
Concevoir des applications SharePoint basées sur la recherche
Concevoir des applications SharePoint basées sur la rechercheConcevoir des applications SharePoint basées sur la recherche
Concevoir des applications SharePoint basées sur la rechercheFranck Cornu
 
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity PresentationRails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentationrailsconf
 

Viewers also liked (8)

Photo Album2 3
Photo Album2 3Photo Album2 3
Photo Album2 3
 
Progamme XKE Janvier 2012
Progamme XKE Janvier 2012Progamme XKE Janvier 2012
Progamme XKE Janvier 2012
 
100 tips for building and maintaining a successful blog
100 tips for building and maintaining a successful blog100 tips for building and maintaining a successful blog
100 tips for building and maintaining a successful blog
 
salkdjfhdjkghdfkjh
salkdjfhdjkghdfkjhsalkdjfhdjkghdfkjh
salkdjfhdjkghdfkjh
 
App211 techdays 2013 Windows 8 concevoir des applications efficaces et perfor...
App211 techdays 2013 Windows 8 concevoir des applications efficaces et perfor...App211 techdays 2013 Windows 8 concevoir des applications efficaces et perfor...
App211 techdays 2013 Windows 8 concevoir des applications efficaces et perfor...
 
Concevoir des applications SharePoint basées sur la recherche
Concevoir des applications SharePoint basées sur la rechercheConcevoir des applications SharePoint basées sur la recherche
Concevoir des applications SharePoint basées sur la recherche
 
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity PresentationRails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
 
aergserga
aergsergaaergserga
aergserga
 

Similar to Howdoesgettemplatepartworksintwentytentheme 110123234953-phpapp02

What are child themes, and why use them
What are child themes, and why use themWhat are child themes, and why use them
What are child themes, and why use themUtsav Singh Rathour
 
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 updateLaura Scott
 
Theming Search Results - How to Make Your Search Results Rock
Theming Search Results - How to Make Your Search Results RockTheming Search Results - How to Make Your Search Results Rock
Theming Search Results - How to Make Your Search Results RockAubrey Sambor
 
Developing client themes for theme review for WordCamp Edmonton
Developing client themes for theme review for WordCamp EdmontonDeveloping client themes for theme review for WordCamp Edmonton
Developing client themes for theme review for WordCamp EdmontonCurtis McHale
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Mike Schinkel
 
Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016Ian Wilson
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentSitdhibong Laokok
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme EnlightenmentAmanda Giles
 
Wordpress Questions & Answers
Wordpress Questions & AnswersWordpress Questions & Answers
Wordpress Questions & AnswersNicole Dion
 
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 ...LinnAlexandra
 
Word press templates
Word press templatesWord press templates
Word press templatesDan Phiffer
 
Joomla! Day Chicago 2011 - Templating the right way - Jonathan Shroyer
Joomla! Day Chicago 2011 - Templating the right way - Jonathan ShroyerJoomla! Day Chicago 2011 - Templating the right way - Jonathan Shroyer
Joomla! Day Chicago 2011 - Templating the right way - Jonathan ShroyerSteven Pignataro
 
Introduction to WordPress Plugin Development, WordCamp North Canton, 2015
Introduction to WordPress Plugin Development, WordCamp North Canton, 2015Introduction to WordPress Plugin Development, WordCamp North Canton, 2015
Introduction to WordPress Plugin Development, WordCamp North Canton, 2015topher1kenobe
 
Child Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notesChild Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notesDamien Carbery
 
Jumpstart Your Development with ZopeSkel
Jumpstart Your Development with ZopeSkelJumpstart Your Development with ZopeSkel
Jumpstart Your Development with ZopeSkelCristopher Ewing
 
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 2012Jonny Allbut
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017Amanda Giles
 
Theme Kickstart
Theme KickstartTheme Kickstart
Theme KickstartPeter
 

Similar to Howdoesgettemplatepartworksintwentytentheme 110123234953-phpapp02 (20)

What are child themes, and why use them
What are child themes, and why use themWhat are child themes, and why use them
What are child themes, and why use them
 
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
 
Theming Search Results - How to Make Your Search Results Rock
Theming Search Results - How to Make Your Search Results RockTheming Search Results - How to Make Your Search Results Rock
Theming Search Results - How to Make Your Search Results Rock
 
Developing client themes for theme review for WordCamp Edmonton
Developing client themes for theme review for WordCamp EdmontonDeveloping client themes for theme review for WordCamp Edmonton
Developing client themes for theme review for WordCamp Edmonton
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
 
&lt;?php + WordPress
&lt;?php + WordPress&lt;?php + WordPress
&lt;?php + WordPress
 
Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme Development
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme Enlightenment
 
Wordpress Questions & Answers
Wordpress Questions & AnswersWordpress Questions & Answers
Wordpress Questions & Answers
 
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 ...
 
Web 101 intro to html
Web 101  intro to htmlWeb 101  intro to html
Web 101 intro to html
 
Word press templates
Word press templatesWord press templates
Word press templates
 
Joomla! Day Chicago 2011 - Templating the right way - Jonathan Shroyer
Joomla! Day Chicago 2011 - Templating the right way - Jonathan ShroyerJoomla! Day Chicago 2011 - Templating the right way - Jonathan Shroyer
Joomla! Day Chicago 2011 - Templating the right way - Jonathan Shroyer
 
Introduction to WordPress Plugin Development, WordCamp North Canton, 2015
Introduction to WordPress Plugin Development, WordCamp North Canton, 2015Introduction to WordPress Plugin Development, WordCamp North Canton, 2015
Introduction to WordPress Plugin Development, WordCamp North Canton, 2015
 
Child Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notesChild Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notes
 
Jumpstart Your Development with ZopeSkel
Jumpstart Your Development with ZopeSkelJumpstart Your Development with ZopeSkel
Jumpstart Your Development with ZopeSkel
 
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
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017
 
Theme Kickstart
Theme KickstartTheme Kickstart
Theme Kickstart
 

Recently uploaded

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
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.pdfsudhanshuwaghmare1
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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 CVKhem
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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.pdfUK Journal
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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 FresherRemote DBA Services
 
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 educationjfdjdjcjdnsjd
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
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?Igalia
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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?
 

Howdoesgettemplatepartworksintwentytentheme 110123234953-phpapp02

  • 1. How Does get_template_partHow Does get_template_partHow Does get_template_part Works In Twenty Ten Theme How Does get_template_part Works In Twenty Ten Theme By: Rozani Ghani http://rozanighani.com/
  • 2. What Exactly GET_template_part is? • get_template_part is used to load a template part into a template (other than header,part into a template (other than header, sidebar, footer) • get_template_part is used for child theme development but actually is not just for child theme development only, is there more thantheme development only, is there more than that.
  • 3. Let See how GET_template_part is originated? • We see how get_template_part works. • This example may vary with how developer• This example may vary with how developer perception but this is just to illustrate how the the get_template_part works. • I use index.html as the very famous example. • As a clear example, I use the index.php in• As a clear example, I use the index.php in Twenty Ten Theme.
  • 4. Index.html • A wordpress index.html mostly consist of these 4 basic template php files: header.php,these 4 basic template php files: header.php, index.php, sidebar.php and also footer.php. • I visualize these files in order to understand get_template_part is.
  • 5. How Does get_template_partHow Does get_template_partHow Does get_template_part Works In Twenty Ten Theme How Does get_template_part Works In Twenty Ten Theme By: Rozani Ghani http://rozanighani.com/
  • 6. Header.php Index.html Index.php Sidebar.php Footer.php • We break the index.html into the basic wordpress template files.
  • 7. Header.php • We break the index.html into the basic wordpress template files. That is header.php, index.php, sidebar.php and footer.php Index.html Index.php Sidebar.php Footer.php
  • 8. Header.php <?php get_header(); ?> • We break the php into standard WordPress Codex tags. Index.php Sidebar.php Index.php <?php get_sidebar(); ?> Footer.php <?php get_footer(); ?>
  • 9. • Suppose there is a code to replace index.php that is How About index.php? <?php get_header(); ?> replace index.php that is <?php get_index (); ?> • After search in the WordPress codex, <?php get_index (); ?> is not exist. • I prefer not to discuss get_index because Index.php <?php get_sidebar(); ?> get_index because WordPress already done stuff to make the index.php working smoothly. <?php get_footer(); ?>
  • 10. Next… • We going directly to get_template_part. • But first, we going to understand this example.• But first, we going to understand this example. • <?php get_template_part( $slug, $name ); ?> • <?php get_template_part( 'loop', 'index' ); ?> • What the heck are these?
  • 11. What is $slug and $name? • At the 1st sight, I don’t really understand what $slug and $name are.$slug and $name are. • But, I take them as these:  $slug as $ parent  $name as $child • As I take them like that, it much easier to• As I take them like that, it much easier to understand get_template_part and very much of child theme
  • 12. Recall… • <?php get_template_part( $slug, $name ); ?> can be written alsocan be written also is <?php get_template_part( $slug ); ?> • We going to convert those code such as get_header into get_template_part (‘header’)
  • 13. We going to convert those code such as get_header into get_template_part (‘header’) <?php get_template_part(‘header’); ?> <?php get_header(); ?> <?php get_template_part (‘index’); ?> <?php get_template_ part(‘sidebar’) ; ?> Index.php <?php get_sidebar(); ?> ; ?> <?php get_template_part(‘footer’); ?> <?php get_footer(); ?>
  • 14. We can conclude that the get_template_part works like this. <?php get_header(); ?> <?php get_template_part(‘index’); ?> <?php get_sidebar(); ?> <?php get_footer(); ?>
  • 15. The real index.php of Twenty Ten Theme looks like this. <?php get_header(); ?> <div id="container"> <div id="content" role="main"> <?php get_template_part( 'loop', 'index' );?> <?php get_sidebar(); ?> </div><!-- #content --> </div><!-- #container --> <?php get_footer(); ?>
  • 16. Index.php of Twenty Ten Theme • Its look this: The index.php is using <?php• The index.php is using <?php get_template_part (‘loop’, ‘index’); ?>
  • 17. Why? • <?php get_template_part (‘loop’, ‘index’); ?> is used to load loop-index.php.is used to load loop-index.php. • What if loop-index.php not exists? • get_template_part will load loop.php
  • 18. Back to $slug and $name Coding Technically • Codex: File Rename Technically • Codex:• Codex: • <?php get_template_part( $slug, $name ); ?> • Example: • <?php get_template_part( 'loop', 'index' ); ?> • Codex: • $slug-$name.php • Example: • loop-index.php 'loop', 'index' ); ?> • must have “-” between $slug and $name
  • 19. Why $parent and $child? • To me, it is easier to understand and not much confused.confused. • Back to loop-index.php, this file already a child php file. • If <?php get_template_part (‘loop’, ‘index’); ?> try to load loop-index.php but it fail, it willtry to load loop-index.php but it fail, it will load her parent php file which is loop.php • Agree ?
  • 20. How Does get_template_partHow Does get_template_partHow Does get_template_part Works In Twenty Ten Theme How Does get_template_part Works In Twenty Ten Theme By: Rozani Ghani http://rozanighani.com/
  • 21. Another Example Much Similar • If you have Twenty Ten Theme, you should the the footer.php file. See this:the footer.php file. See this: • Much prettier right? But it is for sidebar. • That code will load sidebar-footer.php• That code will load sidebar-footer.php
  • 22. sidebar-footer.php • <?php get_sidebar( 'footer' );?> • is similar to• is similar to • <?php get_template_part ( 'footer' );?> • Why? • Look the php file which is sidebar-footer.php • Revise back what you have learn.
  • 23. How Does get_template_partHow Does get_template_partHow Does get_template_part Works In Twenty Ten Theme How Does get_template_part Works In Twenty Ten Theme By: Rozani Ghani http://rozanighani.com/