SlideShare uma empresa Scribd logo
1 de 22
THEME DEVELOPMENT IN
WORDPRESS
By:
Junejo Naeem Ahmed
WHY WORDPRESS THEMES?
• To create a unique look for your WordPress site .
• To take advantage of templates, template tags, and
the WordPress Loop to generate different website
results and looks .
• To provide alternative templates for specific site
features, such as category pages and search result
pages .
• To quickly switch between two site layouts, or to take
advantage of a Theme or style switcher to allow site
owners to change the look of your site .
A WORDPRESS THEME HAS MANY BENEFITS, TOO .
• It separates the presentation styles and template
files from the system files so the site will upgrade
without drastic changes to the visual presentation of
the site.
• It allows for customization of the site functionality
unique to that Theme.
• It allows for quick changes of the visual design and
layout of a WordPress site.
• It removes the need for a typical WordPress site
owner to have to learn CSS, HTML, and PHP in order
to have a great-looking website .
WHY SHOULD YOU BUILD YOUR OWN WORDPRESS
THEME? THAT'S THE REAL QUESTION.

• It's an opportunity to learn more about
CSS, HTML, and PHP.
• It's an opportunity to put your expertise with
CSS, HTML, and PHP to work.
• It's creative.
• It's fun (most of the time).
• If you release it to the public, you can feel
good that you shared and gave something
back to the WordPress Community
THEME DEVELOPMENT STANDARDS
• WordPress Themes should be coded using the
following standards:
• Use well-structured, error-free PHP and valid
HTML. ( WordPress Coding Standards ).
• Use clean, valid CSS. ( CSS Coding Standards ).
• Follow design guidelines in Site Design and
Layout .
ANATOMY OF A THEME
• WordPress Themes live in subdirectories of the WordPress
themes directory (wp-content/themes/ by default).
• The Theme's subdirectory holds all of the Theme's stylesheet
files, template files, and optional functions file
(functions.php), JavaScript files, and images.
• For example, a Theme named "test" would reside in the
directory wp-content/themes/test/.
• Avoid using numbers for the theme name, as this prevents it
from being displayed in the available themes list.
• WordPress includes a default theme in each new installation.
Examine the files in the default theme carefully to get a better
idea of how to build your own Theme files.
THEME STYLESHEET
• In addition to CSS style information for your theme, style.css
provides details about the Theme in the form of comments.
• The stylesheet must provide details about the Theme in the
form of comments.
• No two Themes are allowed to have the same details listed in
their comment headers.
• If you make your own Theme by copying an existing one,
make sure you change this information first.
THEME STYLESHEET (Cont’d)
FUNCTIONS FILE
• A theme can optionally use a functions file, which resides in
the theme subdirectory and is named functions.php.
• This file basically acts like a plugin, and if it is present in the
theme you are using, it is automatically loaded during
WordPress initialization (both for admin pages and external
pages).
• Enable Theme Features such as Sidebars, Navigation
Menus, Post Thumbnails, Post Formats, Custom
Headers, Custom Backgrounds and others.
• Set up an options menu, giving site owners options for
colors, styles, and other aspects of your theme.
WHAT IS A TEMPLATE TAG
• A template tag is code that instructs WordPress to
"do" or "get" something.
• In the case of the header.php template tag for your
WordPress site's name, it looks like this:
• <h1><?php bloginfo('name'); ?></h1>
TEMPLATE TAG -bloginfo
• Displays information about your site, mostly gathered from
the information you supply in your User Profile and General
Settings WordPress Administration Screens.
• It can be used anywhere within a template file.
• This always prints a result to the browser.
• If you need the values for use in PHP, use get_bloginfo().

• Usage
– <?php bloginfo( $show ); ?>

• Parameters
– $show(string) (Optional) Keyword naming the information you want.
– Default: name
HOW TO PASS TAG PARAMETERS
• like PHP functions, many template tags accept arguments, or
parameters.
• Template tag parameters are variables you can use to change
a tag's output or otherwise modify its action in some way.
• Tags without parameters
• Tags with PHP function-style parameters
– Some functions take multiple parameters.
– Multiple parameters are separated by commas.
– The order of parameters is important!

• Tags with query-string-style parameters
INCLUDE TAGS
• The Template include tags are used within one Template file
to execute the HTML and PHP found in another template file.
• Include Generic Files
–
–
–
–

get_header()
get_footer()
get_sidebar()
get_template_part()

• Include Other Components
– get_search_form()
– comments_template()
CONDITIONAL TAGS
• All of the Conditional Tags test to see whether a certain
condition is met, and then returns either TRUE or FALSE.
–
–
–
–

Is_home()
Is_single();
Is_admin();
Is_category();
HOW WORDPRESS WORKS
• Visitors requests initial WordPress page: index.php
• WordPress activates themes
• WordPress checks to see which template files are
present
• Gathers settings stored in database
• Retrieves specified number of most recent posts
• Stores post data
(title, author, content, comments, etc.) in variables
• Outputs data into theme page
BASIC WORDPRESS THEME PAGE STRUCTURE AND ELEMENTS

•
•
•
•
•
•

Header (header.php)
Main content (index.php)
Sidebar with Widget (sidebar.php)
Footer (footer.php)
CSS (style.css)
The stylesheet called style.css, which controls the
presentation (visual design and layout) of the
website pages.
ANATOMY OF A THEME
THE 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.
• Any HTML or PHP code in the Loop will be processed
on each post.
THE LOOP: VISIUAL MODEL
ADDITIONAL WORDPRESS TEMPLATE FILES
•
•
•
•
•

Archive (archive.php)
Custom Page (page.php)
Single Post (single.php)
Comments (comments.php)
Search Results (search.php)
THE ARCHIVE TEMPATE FILE
•
•
•
•
•
•
•
•

archive.php
Fall back for 6 different page types:
Author
Tag
Category
Taxonomy
Date
Archives
THE CUSTOM PAGE TEMPATE FILE
• page.php
• Used to create all custom pages
• Additional custom page template can be created

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

How WordPress Themes Work
How WordPress Themes WorkHow WordPress Themes Work
How WordPress Themes Work
 
Introduction of wordpress, Wordpress Training Ahmedabad, Wordpress Class Ahme...
Introduction of wordpress, Wordpress Training Ahmedabad, Wordpress Class Ahme...Introduction of wordpress, Wordpress Training Ahmedabad, Wordpress Class Ahme...
Introduction of wordpress, Wordpress Training Ahmedabad, Wordpress Class Ahme...
 
Front end for back end developers
Front end for back end developersFront end for back end developers
Front end for back end developers
 
"15 Technique to Exploit File Upload Pages", Ebrahim Hegazy
"15 Technique to Exploit File Upload Pages", Ebrahim Hegazy"15 Technique to Exploit File Upload Pages", Ebrahim Hegazy
"15 Technique to Exploit File Upload Pages", Ebrahim Hegazy
 
Responsive web-design through bootstrap
Responsive web-design through bootstrapResponsive web-design through bootstrap
Responsive web-design through bootstrap
 
Introduction to Bootstrap
Introduction to BootstrapIntroduction to Bootstrap
Introduction to Bootstrap
 
Installation xampp and WordPress on localhost
Installation xampp and WordPress on localhostInstallation xampp and WordPress on localhost
Installation xampp and WordPress on localhost
 
Corso Pratico di WordPress
Corso Pratico di WordPressCorso Pratico di WordPress
Corso Pratico di WordPress
 
Highcharts
HighchartsHighcharts
Highcharts
 
WordPress plugins
WordPress pluginsWordPress plugins
WordPress plugins
 
Sessions and cookies
Sessions and cookiesSessions and cookies
Sessions and cookies
 
Wordpress
WordpressWordpress
Wordpress
 
WordPress Complete Tutorial
WordPress Complete TutorialWordPress Complete Tutorial
WordPress Complete Tutorial
 
WordPress Webinar Training Presentation
WordPress Webinar Training PresentationWordPress Webinar Training Presentation
WordPress Webinar Training Presentation
 
Google Keyword Planner - New Keyword Research Tool by Google
Google Keyword Planner - New Keyword Research Tool by GoogleGoogle Keyword Planner - New Keyword Research Tool by Google
Google Keyword Planner - New Keyword Research Tool by Google
 
Bypass file upload restrictions
Bypass file upload restrictionsBypass file upload restrictions
Bypass file upload restrictions
 
Sqlmap
SqlmapSqlmap
Sqlmap
 
Introduction to Wordpress
Introduction to WordpressIntroduction to Wordpress
Introduction to Wordpress
 
Html and css
Html and cssHtml and css
Html and css
 
Wordpress
WordpressWordpress
Wordpress
 

Semelhante a Wordpress theme development

Word press bootcamp By Sourcescript Innovations and Mentors Dojo
Word press bootcamp  By Sourcescript Innovations and Mentors DojoWord press bootcamp  By Sourcescript Innovations and Mentors Dojo
Word press bootcamp By Sourcescript Innovations and Mentors Dojo
lightshire
 
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
 
American University WordPress Theming Lecture
American University WordPress Theming LectureAmerican University WordPress Theming Lecture
American University WordPress Theming Lecture
Aaron Brazell
 

Semelhante a Wordpress theme development (20)

Wordpress template hierarchy
Wordpress template hierarchyWordpress template hierarchy
Wordpress template hierarchy
 
Starting WordPress Theme Review
Starting WordPress Theme ReviewStarting WordPress Theme Review
Starting WordPress Theme Review
 
Word press bootcamp By Sourcescript Innovations and Mentors Dojo
Word press bootcamp  By Sourcescript Innovations and Mentors DojoWord press bootcamp  By Sourcescript Innovations and Mentors Dojo
Word press bootcamp By Sourcescript Innovations and Mentors Dojo
 
WordPress Themes and Plugins
WordPress Themes and PluginsWordPress Themes and Plugins
WordPress Themes and Plugins
 
WCBos13 intermediate workshop
WCBos13 intermediate workshopWCBos13 intermediate workshop
WCBos13 intermediate workshop
 
Introduction to Custom WordPress Themeing
Introduction to Custom WordPress ThemeingIntroduction to Custom WordPress Themeing
Introduction to Custom WordPress Themeing
 
Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016
 
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
 
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
 
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
 
Anatomy of a Wordpress theme
Anatomy of a Wordpress themeAnatomy of a Wordpress theme
Anatomy of a Wordpress theme
 
Keeping Your Themes and Plugins Organized.
Keeping Your Themes and Plugins Organized.Keeping Your Themes and Plugins Organized.
Keeping Your Themes and Plugins Organized.
 
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
 
American University WordPress Theming Lecture
American University WordPress Theming LectureAmerican University WordPress Theming Lecture
American University WordPress Theming Lecture
 
Intro To WordPress Themes
Intro To WordPress ThemesIntro To WordPress Themes
Intro To WordPress Themes
 
MCC Web Design Workshop
MCC Web Design WorkshopMCC Web Design Workshop
MCC Web Design Workshop
 
Submitting to the WordPress Theme Directory
Submitting to the WordPress Theme DirectorySubmitting to the WordPress Theme Directory
Submitting to the WordPress Theme Directory
 
Websites With Wordpress
Websites With WordpressWebsites With Wordpress
Websites With Wordpress
 
WordPress Template hierarchy
WordPress Template hierarchyWordPress Template hierarchy
WordPress Template hierarchy
 
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slides
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slidesKeep Your Code Organized! WordCamp Montreal 2013 Presentation slides
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slides
 

Mais de Naeem Junejo (6)

Freelancing
FreelancingFreelancing
Freelancing
 
Introduction databases and MYSQL
Introduction databases and MYSQLIntroduction databases and MYSQL
Introduction databases and MYSQL
 
WordPress theme setting page
WordPress theme setting pageWordPress theme setting page
WordPress theme setting page
 
Introduction To WordPress
Introduction To WordPressIntroduction To WordPress
Introduction To WordPress
 
jQuery Mobile
jQuery MobilejQuery Mobile
jQuery Mobile
 
Wordpress custom-posttype
Wordpress custom-posttypeWordpress custom-posttype
Wordpress custom-posttype
 

Último

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
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
 

Último (20)

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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
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
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
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
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
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
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
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...
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 

Wordpress theme development

  • 2. WHY WORDPRESS THEMES? • To create a unique look for your WordPress site . • To take advantage of templates, template tags, and the WordPress Loop to generate different website results and looks . • To provide alternative templates for specific site features, such as category pages and search result pages . • To quickly switch between two site layouts, or to take advantage of a Theme or style switcher to allow site owners to change the look of your site .
  • 3. A WORDPRESS THEME HAS MANY BENEFITS, TOO . • It separates the presentation styles and template files from the system files so the site will upgrade without drastic changes to the visual presentation of the site. • It allows for customization of the site functionality unique to that Theme. • It allows for quick changes of the visual design and layout of a WordPress site. • It removes the need for a typical WordPress site owner to have to learn CSS, HTML, and PHP in order to have a great-looking website .
  • 4. WHY SHOULD YOU BUILD YOUR OWN WORDPRESS THEME? THAT'S THE REAL QUESTION. • It's an opportunity to learn more about CSS, HTML, and PHP. • It's an opportunity to put your expertise with CSS, HTML, and PHP to work. • It's creative. • It's fun (most of the time). • If you release it to the public, you can feel good that you shared and gave something back to the WordPress Community
  • 5. THEME DEVELOPMENT STANDARDS • WordPress Themes should be coded using the following standards: • Use well-structured, error-free PHP and valid HTML. ( WordPress Coding Standards ). • Use clean, valid CSS. ( CSS Coding Standards ). • Follow design guidelines in Site Design and Layout .
  • 6. ANATOMY OF A THEME • WordPress Themes live in subdirectories of the WordPress themes directory (wp-content/themes/ by default). • The Theme's subdirectory holds all of the Theme's stylesheet files, template files, and optional functions file (functions.php), JavaScript files, and images. • For example, a Theme named "test" would reside in the directory wp-content/themes/test/. • Avoid using numbers for the theme name, as this prevents it from being displayed in the available themes list. • WordPress includes a default theme in each new installation. Examine the files in the default theme carefully to get a better idea of how to build your own Theme files.
  • 7. THEME STYLESHEET • In addition to CSS style information for your theme, style.css provides details about the Theme in the form of comments. • The stylesheet must provide details about the Theme in the form of comments. • No two Themes are allowed to have the same details listed in their comment headers. • If you make your own Theme by copying an existing one, make sure you change this information first.
  • 9. FUNCTIONS FILE • A theme can optionally use a functions file, which resides in the theme subdirectory and is named functions.php. • This file basically acts like a plugin, and if it is present in the theme you are using, it is automatically loaded during WordPress initialization (both for admin pages and external pages). • Enable Theme Features such as Sidebars, Navigation Menus, Post Thumbnails, Post Formats, Custom Headers, Custom Backgrounds and others. • Set up an options menu, giving site owners options for colors, styles, and other aspects of your theme.
  • 10. WHAT IS A TEMPLATE TAG • A template tag is code that instructs WordPress to "do" or "get" something. • In the case of the header.php template tag for your WordPress site's name, it looks like this: • <h1><?php bloginfo('name'); ?></h1>
  • 11. TEMPLATE TAG -bloginfo • Displays information about your site, mostly gathered from the information you supply in your User Profile and General Settings WordPress Administration Screens. • It can be used anywhere within a template file. • This always prints a result to the browser. • If you need the values for use in PHP, use get_bloginfo(). • Usage – <?php bloginfo( $show ); ?> • Parameters – $show(string) (Optional) Keyword naming the information you want. – Default: name
  • 12. HOW TO PASS TAG PARAMETERS • like PHP functions, many template tags accept arguments, or parameters. • Template tag parameters are variables you can use to change a tag's output or otherwise modify its action in some way. • Tags without parameters • Tags with PHP function-style parameters – Some functions take multiple parameters. – Multiple parameters are separated by commas. – The order of parameters is important! • Tags with query-string-style parameters
  • 13. INCLUDE TAGS • The Template include tags are used within one Template file to execute the HTML and PHP found in another template file. • Include Generic Files – – – – get_header() get_footer() get_sidebar() get_template_part() • Include Other Components – get_search_form() – comments_template()
  • 14. CONDITIONAL TAGS • All of the Conditional Tags test to see whether a certain condition is met, and then returns either TRUE or FALSE. – – – – Is_home() Is_single(); Is_admin(); Is_category();
  • 15. HOW WORDPRESS WORKS • Visitors requests initial WordPress page: index.php • WordPress activates themes • WordPress checks to see which template files are present • Gathers settings stored in database • Retrieves specified number of most recent posts • Stores post data (title, author, content, comments, etc.) in variables • Outputs data into theme page
  • 16. BASIC WORDPRESS THEME PAGE STRUCTURE AND ELEMENTS • • • • • • Header (header.php) Main content (index.php) Sidebar with Widget (sidebar.php) Footer (footer.php) CSS (style.css) The stylesheet called style.css, which controls the presentation (visual design and layout) of the website pages.
  • 17. ANATOMY OF A THEME
  • 18. THE 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. • Any HTML or PHP code in the Loop will be processed on each post.
  • 20. ADDITIONAL WORDPRESS TEMPLATE FILES • • • • • Archive (archive.php) Custom Page (page.php) Single Post (single.php) Comments (comments.php) Search Results (search.php)
  • 21. THE ARCHIVE TEMPATE FILE • • • • • • • • archive.php Fall back for 6 different page types: Author Tag Category Taxonomy Date Archives
  • 22. THE CUSTOM PAGE TEMPATE FILE • page.php • Used to create all custom pages • Additional custom page template can be created