Dissecting WordPress Themes and Page Templates, WordPress Columbus Meetup


Published on

Dissecting WordPress Themes and Page Templates, WordPress Columbus Meetup

Published in: Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Dissecting WordPress Themes and Page Templates, WordPress Columbus Meetup

  1. 1. #wpcbus www.wpohio.com Follow @wpohio TONIGHT’S SPEAKER @angiemeeker WWW.ANGIEMEEKERDESIGNS.COMGet on the internet here using username/password: dtc_guest
  3. 3. WHY?Form and functionare two different,but relatedthings.
  4. 4. IF WORDPRESS THREW UP. wp-admin wp-content The wp-config.php file contains a roadmap to your MySQL database. wp-includes other files including wp- wp-config.php .htaccess index.php
  5. 5. Inside wp-config.php isWordPress’ roadmap for connecting to MySQL database
  6. 6. define (‘DB_INFORMATION’)When installing WordPress yourself manually,you have to enter these values after creating a MySQL database.When using a one-click install through a hosting company,they create the database and fill in these values for you.
  7. 7. WHAT’S IS IN THE DATABASE?Tables of all of your stuff.http://codex.wordpress.org/Database_Descriptionwp_commentmeta Meta information per commentwp_comments Commentswp_links Information related to the Links featurewp_options Options set under Administration>Settingswp_postmeta Meta information per postwp_posts Posts, Pages, Navigation Menu Itemswp_terms Categories and Tagswp_term_relationships Association of posts with categories, link categorieswp_term_taxonomy Description of taxonomy (category, link, tag)wp_usermeta Meta information per userwp_users List of users
  8. 8. CLEANING UP.With WordPress connected to your MySQL database,we’ll use PHP to retrieve that information throughdirections specific to the page viewed on your site.These PHP directions for each page template,along with the CSS to style those directions,make up your WordPress theme.
  9. 9. WHERE TO FIND YOUR THEMES IN YOUR WP INSTALLwp-wp-content/themes
  10. 10. meetup WHEREwp-admin TO FIND wp-content YOUR themes THEMES twentytwelve IN YOUR plugins WPwp-includes INSTALLother files
  11. 11. twentytwelve ALL THEMES index.php MUST style.css INCLUDE AT LEAST THESE FILES
  12. 12. .csss tyle /* Theme Name: Twenty Twelve Theme URI: http://wordpress.org/ Description: The 2012 default theme for WordPress. Author: wordpressdotorg Author URI: http://wordpress.org/ Version: 1.0 Tags: black, blue, white, two-columns, fixed-width License: License URI: General comments (optional). */ YOUR CSS GOES HERE.
  13. 13. php ex.ind <?php get_header(); (have_posts have_posts()) if (have_posts()) : (have_posts have_posts()) while (have_posts()) : the_post(); the_post(); the_content(); the_content(); endwhile; endwhile; endif; endif; get_footer(); ?>
  14. 14. php ex.ind My Site Name Site Description Page One Page Two The full content of my first post would be here. The full content of my second post would be here. Footer Stuff
  15. 15. php ex.ind header first post second post footer
  17. 17. GET THEREUSING TEMPLATES &TEMPLATE TAGS & this we’re barely covering tonight.CSS. this we’re not covering at all. http://codex.wordpress.org/Stepping_Into_Templateshttp://codex.wordpress.org/Stepping_Into_Template_Tags
  18. 18. twentytwelve MOST OFTEN,index.php page.php THEMESstyle.css comments.php INCLUDEheader.php functions.phpsidebar.php THESE, home.phpfooter.php front-page.php TOO.single.phparchive.phpcategory.phptag.php
  19. 19. index.php MOST OFTEN,One template to THEMESrule them all. INCLUDE THESE, style.css TOO.Defines the style of theHTML elements of yoursite
  20. 20. home.php MOST OFTEN,Default front page THEMES(which by default INCLUDEshows latest posts). THESE, TOO.If you use a static pageas your front page,this template is used foryour “Posts Page.”
  21. 21. front-page.php MOST OFTEN,If you use a static page THEMESas your front page, INCLUDEthis is the template used. THESE, TOO.
  22. 22. single.php MOST OFTEN,Displays a single post. THEMES INCLUDE THESE, TOO.
  23. 23. page.php MOST OFTEN,Displays a single page. THEMES INCLUDE THESE, TOO.
  24. 24. header.php MOST OFTEN,Add a call to wp_head().<?php wp_head(); ?> THEMESPlugins use this action hook to add their own scripts,stylesheets, and other functionality. INCLUDEInclude a call to the nav menu THESE,<?php wp_nav_menu(); ?> TOO.
  25. 25. footer.php MOST OFTEN,Should include a call to THEMESthe footer before the INCLUDEclosing body tags: THESE,<?php wp_footer(); ?> TOO.</body></html>(Bad themes don’t have this,and curse the world because of it).
  26. 26. comments.php MOST OFTEN,Used to display the THEMEScomments template. INCLUDE THESE, TOO.
  27. 27. sidebar.php MOST OFTEN,Used to display a sidebar THEMESand its widgetized areas INCLUDE THESE, TOO.
  28. 28. functions.php MOST OFTEN,Enable features such as THEMESSidebars INCLUDENavigation Menus THESE,Post Thumbnails TOO.Post FormatsCustom HeadersCustom BackgroundsAdditional Widget Are
  29. 29. archive.php MOST OFTEN,Used when a category, THEMESauthor, or date is queried. INCLUDE THESE,Will be overidden if a TOO.category.php, author.phpor date.php template isavailable.
  30. 30. category.php MOST OFTEN,Used to display a THEMEScategory archive. INCLUDE THESE, TOO.
  31. 31. tag.php MOST OFTEN,Used to display a tag THEMESarchive. INCLUDE THESE, TOO. date.phpUsed to display a datearchive (year, month,week, date).
  32. 32. This was only an intro.The Loop leads to… Multiple loops…Templates lead to… Custom templates…Template tags lead to… Conditional tags…
  33. 33. Angie Meeker@angiemeekerangie@angiemeekerdesigns.com614.353.0633Download sample files:http://goo.gl/IFzhz