5. Template Parts
•
Naming conventions and organization.
•
•
•
Prefix page templates “page-about-template.php” or nest
them in a “page-templates” folder.
For partial templates, use logical and consistent conventions.
Lean toward smaller templates.
•
•
Are you repeating yourself? Make it a template part.
Give good and thorough comment blocks at the top of
templates, even partial ones
8. Follow the guides
•
Seriously, take the time to properly format your
code.
•
http://codex.wordpress.org/
WordPress_Coding_Standards
9. Entering and exiting PHP
•
In templates versus functions / operational code
•
When in PHP, stay in PHP
10. Curly brackets versus alternative
syntax for control structures
•
http://php.net/manual/en/controlstructures.alternative-syntax.php
•
http://pippinsplugins.com/please-do-not-usecurly-brackets-in-template-files/
•
http://tommcfarlin.com/commenting-code-blocks/
14. Hook Order
•
Core Load http://www.rarst.net/script/wordpresscore-load/
•
Wowza hooks http://codex.wordpress.org/
Plugin_API/Action_Reference
•
Special shoutout to template_redirect
(conditionals)
15. Action and filters
•
Make your parent themes filterable!
•
Intro: http://pippinsplugins.com/a-quickintroduction-to-using-filters/
•
You can do it: http://wp.tutsplus.com/tutorials/
plugins/writing-extensible-plugins-with-actionsand-filters/
16. Properly enqueue scripts
and styles
•
http://wpcandy.com/teaches/how-to-load-scripts-inwordpress-themes/
•
http://wp.tutsplus.com/tutorials/the-ins-and-outs-of-theenqueue-script-for-wordpress-themes-and-plugins/
•
Register, then enqueue
•
Only enqueue when you need to
•
•
Conditionals in the enqueue function, or right in the
function or template
Load in the footer most of the time
19. WordPress URLs
•
The URL tells WordPress what to look up. Always
remember this.
•
http://wp.tutsplus.com/tutorials/creative-coding/
the-rewrite-api-the-basics/
20. Loops
•
The default WordPress loop
•
WP_Query: http://codex.wordpress.org/Class_Reference/WP_Query
•
Best. Presentation. Ever. http://wordpress.tv/2013/03/15/andrew-nacinwp_query-wordpress-in-depth/
•
wp_reset_postdata() vs wp_reset_query() http://www.poststat.us/properlyreset-wordpress-query/
•
update_post_meta_cache & update_post_term_cache
•
get_posts
•
pre_get_posts hook http://codex.wordpress.org/Plugin_API/Action_Reference/
pre_get_posts
•
If you use query_posts(), go home.
21. Post Meta
•
get_post_custom() versus lots of get_post_meta().
•
Check for existence before output to prevent empty markup.
•
Classes / Tools.
•
Advanced Custom Fields
•
Pods
•
CMB
•
Core??? http://make.wordpress.org/core/tag/
metamorphosis/
23. Responsive Design
•
Either do it right, or don’t do it.
•
<meta name=“viewport” content=“width=device-width, initialscale=1”>
•
Separate stylesheet? It depends.
•
If not mobile first or using a PreProcessor, and building a parent
them, then yes.
•
Consider navigation http://www.poststat.us/wordpress-responsivenavigation-options/
•
Consider what *could* go into different areas
•
Breakpoints are arbitrary.