SlideShare una empresa de Scribd logo
1 de 19
WordPress Theming
Custom Pages, Custom Post Types, & Custom Fields




                 Lori Berkowitz
              http://beedragon.com
Overview
•   The Codex ♥

• Template Tags/
    Template Hierarchy

• The Loop
• Custom Loops /
    Multiple Loops

• Custom Fields
• Custom Post Types
WordPress Codex

• http://codex.wordpress.org
• /Template_Tags
• /Conditional_Tags
• /Include_tags
• /Function_Reference
Child Themes
•   Separate template folder than parent theme
•   Uses parent theme files unless overridden
•   Must have a style.css file
    /*
    Theme Name: awesome
    Theme URI: http: //beedragon.com/
    Description: awesome child theme for twentyten
    Author: Lori B
    Author URI: http: //lbnuke.com/
    Template: twentyten
    Version: 1.0
    */
    @import url('../twentyten/style.css'); /* import parent styles */

    Parent themes: twentyten, Thematic, Hybrid, Genesis*, Thesis*
    ( * Commercial Theme )
Include Tags
          Work like PHP include() statements

•   <?php get_header(); ?>          Includes header.php

•   <?php get_sidebar(); ?>         Includes sidebar.php

•   <?php get_footer(); ?>          Includes footer.php

•   <?php get_search_form() ?>      Includes searchform.php

•   <?php comments_template(); ?>   Includes comments.php
Conditional Tags
•   is_home()          Main blog page

•   is_front_page()    Front page from Settings > Reading

•   is_single()        Single post page

•   is_sticky()        Returns true if sticky box is checked

•   is_page()          A "page" page

•   is_category()      Category archive page

•   is_author()        Author page

•   is_404()           HTTP 404: Not Found error page
Tag Parameters
       For template tags, conditional
           tags, include tags, etc.

                    Examples:

is_page( '19' ) Page with ID 19
is_page( 'about' ) About page (slug)
is_page( 'About Me' ) About page (post title)
is_page ( array( 19, 'about', 'Contact Us' ) )
Returns true when displayed page is either post ID 19
OR post_name "about-me" OR post_title "Contact Us"
Conditional Tag with a Parameter
 Add CSS class to posts in Category 3 only:
Example Post Code
Template Hierarchy
Home:             Search:            404:
• home.php        • search.php        • 404.php
• index.php       • index.php         • index.php

Post:            Page:             Category:
• single-        • pagename.php    • category-slug.php
  posttype.php   • page-slug.php   • category-id.php
• single.php     • page-id.php     • category.php
• index.php      • page.php        • archive.php
                 • index.php       • index.php
The Loop
The Loop displays WordPress posts.
query_posts();
 Query the WP database for pet posts:
 Before the Loop: query_posts( 'post_type = pets' );




The query_posts function is intended to be used to
modify the main page Loop only.
Pets
Page
Multiple Loops: wp_query();




          <!-- Start the default loop -->
Custom Fields
dob



Display the
custom fields



   dob
Custom
 Post
 Type
Questions?

Más contenido relacionado

La actualidad más candente

WordPress
WordPressWordPress
WordPressrisager
 
Starting WordPress Theme Review
Starting WordPress Theme ReviewStarting WordPress Theme Review
Starting WordPress Theme ReviewCatch Themes
 
TERMINALFOUR t44u 2011- Did you know - CMS and live search
TERMINALFOUR t44u 2011- Did you know - CMS and live searchTERMINALFOUR t44u 2011- Did you know - CMS and live search
TERMINALFOUR t44u 2011- Did you know - CMS and live searchTerminalfour
 
Creating Customizable Widgets for Unpredictable Needs
Creating Customizable Widgets for Unpredictable NeedsCreating Customizable Widgets for Unpredictable Needs
Creating Customizable Widgets for Unpredictable NeedsAmanda Giles
 
Word press interview question and answer tops technologies
Word press interview question and answer   tops technologiesWord press interview question and answer   tops technologies
Word press interview question and answer tops technologiesTOPS Technologies
 
Making drupal beautiful with web fonts
Making drupal beautiful with web fontsMaking drupal beautiful with web fonts
Making drupal beautiful with web fontsFour Kitchens
 
WordPress Theme Development
WordPress Theme DevelopmentWordPress Theme Development
WordPress Theme DevelopmentSantosh Kunwar
 
Using JSLink and Display Temlates with the LVWP
Using JSLink and Display Temlates with the LVWPUsing JSLink and Display Temlates with the LVWP
Using JSLink and Display Temlates with the LVWPSPC Adriatics
 
ActiveRecord Association (1), Season 2
ActiveRecord Association (1), Season 2ActiveRecord Association (1), Season 2
ActiveRecord Association (1), Season 2RORLAB
 

La actualidad más candente (10)

WordPress
WordPressWordPress
WordPress
 
Starting WordPress Theme Review
Starting WordPress Theme ReviewStarting WordPress Theme Review
Starting WordPress Theme Review
 
TERMINALFOUR t44u 2011- Did you know - CMS and live search
TERMINALFOUR t44u 2011- Did you know - CMS and live searchTERMINALFOUR t44u 2011- Did you know - CMS and live search
TERMINALFOUR t44u 2011- Did you know - CMS and live search
 
Creating Customizable Widgets for Unpredictable Needs
Creating Customizable Widgets for Unpredictable NeedsCreating Customizable Widgets for Unpredictable Needs
Creating Customizable Widgets for Unpredictable Needs
 
Word press interview question and answer tops technologies
Word press interview question and answer   tops technologiesWord press interview question and answer   tops technologies
Word press interview question and answer tops technologies
 
Making drupal beautiful with web fonts
Making drupal beautiful with web fontsMaking drupal beautiful with web fonts
Making drupal beautiful with web fonts
 
WordPress Theme Development
WordPress Theme DevelopmentWordPress Theme Development
WordPress Theme Development
 
Using JSLink and Display Temlates with the LVWP
Using JSLink and Display Temlates with the LVWPUsing JSLink and Display Temlates with the LVWP
Using JSLink and Display Temlates with the LVWP
 
ActiveRecord Association (1), Season 2
ActiveRecord Association (1), Season 2ActiveRecord Association (1), Season 2
ActiveRecord Association (1), Season 2
 
Creating forms
Creating formsCreating forms
Creating forms
 

Destacado

Destacado (12)

COT Supervisor Safety Course
COT Supervisor Safety CourseCOT Supervisor Safety Course
COT Supervisor Safety Course
 
Aprendizaje autonomo
Aprendizaje autonomoAprendizaje autonomo
Aprendizaje autonomo
 
DPTVpresentationcompressed
DPTVpresentationcompressedDPTVpresentationcompressed
DPTVpresentationcompressed
 
El baloncesto
El baloncestoEl baloncesto
El baloncesto
 
L2l Hk Pollution
L2l Hk PollutionL2l Hk Pollution
L2l Hk Pollution
 
La comunicación escrita
La comunicación escritaLa comunicación escrita
La comunicación escrita
 
CV Johan 3
CV Johan 3CV Johan 3
CV Johan 3
 
Portaria suspensão biometria 2016
Portaria suspensão biometria 2016Portaria suspensão biometria 2016
Portaria suspensão biometria 2016
 
Diplomaterv védés
Diplomaterv védésDiplomaterv védés
Diplomaterv védés
 
Realidad virtual alexis
Realidad virtual alexisRealidad virtual alexis
Realidad virtual alexis
 
Mobile Operating System Preference
Mobile Operating System PreferenceMobile Operating System Preference
Mobile Operating System Preference
 
Contratos de Servicio y Obra
Contratos de Servicio y ObraContratos de Servicio y Obra
Contratos de Servicio y Obra
 

Similar a Dev Theming

The WordPress University 2012
The WordPress University 2012The WordPress University 2012
The WordPress University 2012Stephanie Leary
 
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)Stephanie Leary
 
Carrington Core (2014)
Carrington Core (2014)Carrington Core (2014)
Carrington Core (2014)alexkingorg
 
The Genesis Framework: Hooks & Filters for Theme Development
The Genesis Framework: Hooks & Filters for Theme DevelopmentThe Genesis Framework: Hooks & Filters for Theme Development
The Genesis Framework: Hooks & Filters for Theme DevelopmentSarah Moyer
 
WordPress Theme Development
 WordPress Theme Development WordPress Theme Development
WordPress Theme DevelopmentBijay Oli
 
Builing a WordPress Theme
Builing a WordPress ThemeBuiling a WordPress Theme
Builing a WordPress Themecertainstrings
 
Anatomy of a Wordpress theme
Anatomy of a Wordpress themeAnatomy of a Wordpress theme
Anatomy of a Wordpress themeDave Wallace
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Themecertainstrings
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme EnlightenmentAmanda Giles
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017Amanda Giles
 
Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014Stephanie Eckles
 
How does get template part works in twenty ten theme
How does get template part works in twenty ten themeHow does get template part works in twenty ten theme
How does get template part works in twenty ten thememohd rozani abd ghani
 
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 WordPressNisha Singh
 
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 #WRK2Curtiss Grymala
 
WordPress Theme Workshop: Part 2
WordPress Theme Workshop: Part 2WordPress Theme Workshop: Part 2
WordPress Theme Workshop: Part 2David Bisset
 
Crash Course in Theme Surgery
Crash Course in Theme SurgeryCrash Course in Theme Surgery
Crash Course in Theme SurgeryRational Frank
 
Theme development essentials columbus oh word camp 2012
Theme development essentials   columbus oh word camp 2012Theme development essentials   columbus oh word camp 2012
Theme development essentials columbus oh word camp 2012Joe Querin
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3David Bisset
 

Similar a Dev Theming (20)

The WordPress University 2012
The WordPress University 2012The WordPress University 2012
The WordPress University 2012
 
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)
 
Carrington Core (2014)
Carrington Core (2014)Carrington Core (2014)
Carrington Core (2014)
 
The Genesis Framework: Hooks & Filters for Theme Development
The Genesis Framework: Hooks & Filters for Theme DevelopmentThe Genesis Framework: Hooks & Filters for Theme Development
The Genesis Framework: Hooks & Filters for Theme Development
 
WordPress Theme Development
 WordPress Theme Development WordPress Theme Development
WordPress Theme Development
 
Builing a WordPress Theme
Builing a WordPress ThemeBuiling a WordPress Theme
Builing a WordPress Theme
 
Anatomy of a Wordpress theme
Anatomy of a Wordpress themeAnatomy of a Wordpress theme
Anatomy of a Wordpress theme
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Theme
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme Enlightenment
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017
 
WordPress theme template tour
WordPress theme template tourWordPress theme template tour
WordPress theme template tour
 
Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014
 
How does get template part works in twenty ten theme
How does get template part works in twenty ten themeHow does get template part works in twenty ten theme
How does get template part works in twenty ten theme
 
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
 
Theming 101
Theming 101Theming 101
Theming 101
 
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
 
WordPress Theme Workshop: Part 2
WordPress Theme Workshop: Part 2WordPress Theme Workshop: Part 2
WordPress Theme Workshop: Part 2
 
Crash Course in Theme Surgery
Crash Course in Theme SurgeryCrash Course in Theme Surgery
Crash Course in Theme Surgery
 
Theme development essentials columbus oh word camp 2012
Theme development essentials   columbus oh word camp 2012Theme development essentials   columbus oh word camp 2012
Theme development essentials columbus oh word camp 2012
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3
 

Dev Theming

  • 1. WordPress Theming Custom Pages, Custom Post Types, & Custom Fields Lori Berkowitz http://beedragon.com
  • 2. Overview • The Codex ♥ • Template Tags/ Template Hierarchy • The Loop • Custom Loops / Multiple Loops • Custom Fields • Custom Post Types
  • 3. WordPress Codex • http://codex.wordpress.org • /Template_Tags • /Conditional_Tags • /Include_tags • /Function_Reference
  • 4. Child Themes • Separate template folder than parent theme • Uses parent theme files unless overridden • Must have a style.css file /* Theme Name: awesome Theme URI: http: //beedragon.com/ Description: awesome child theme for twentyten Author: Lori B Author URI: http: //lbnuke.com/ Template: twentyten Version: 1.0 */ @import url('../twentyten/style.css'); /* import parent styles */ Parent themes: twentyten, Thematic, Hybrid, Genesis*, Thesis* ( * Commercial Theme )
  • 5. Include Tags Work like PHP include() statements • <?php get_header(); ?> Includes header.php • <?php get_sidebar(); ?> Includes sidebar.php • <?php get_footer(); ?> Includes footer.php • <?php get_search_form() ?> Includes searchform.php • <?php comments_template(); ?> Includes comments.php
  • 6. Conditional Tags • is_home() Main blog page • is_front_page() Front page from Settings > Reading • is_single() Single post page • is_sticky() Returns true if sticky box is checked • is_page() A "page" page • is_category() Category archive page • is_author() Author page • is_404() HTTP 404: Not Found error page
  • 7. Tag Parameters For template tags, conditional tags, include tags, etc. Examples: is_page( '19' ) Page with ID 19 is_page( 'about' ) About page (slug) is_page( 'About Me' ) About page (post title) is_page ( array( 19, 'about', 'Contact Us' ) ) Returns true when displayed page is either post ID 19 OR post_name "about-me" OR post_title "Contact Us"
  • 8. Conditional Tag with a Parameter Add CSS class to posts in Category 3 only:
  • 10. Template Hierarchy Home: Search: 404: • home.php • search.php • 404.php • index.php • index.php • index.php Post: Page: Category: • single- • pagename.php • category-slug.php posttype.php • page-slug.php • category-id.php • single.php • page-id.php • category.php • index.php • page.php • archive.php • index.php • index.php
  • 11. The Loop The Loop displays WordPress posts.
  • 12. query_posts(); Query the WP database for pet posts: Before the Loop: query_posts( 'post_type = pets' ); The query_posts function is intended to be used to modify the main page Loop only.
  • 14. Multiple Loops: wp_query(); <!-- Start the default loop -->
  • 18.

Notas del editor