This is an extended and refined version of the presentation I gave at WordCamp Houston.
- Almost every website can be built using a framework.
- Cuts down on development time.
- Reuse code.
- Spectrum: Option-based vs Code-based customization.
- My favorites: Thesis and Genesis.
- See this post for other framework options.
Custom Post Types
- Allow you to separate content types. By default you have Posts and Pages.
- Examples: Projects, Products, News, Rotators…
- Can code it yourself or use Custom Post Type UI plugin.
- Can specify exactly what meta boxes show up on each post type.
- My tutorial on Custom Post Types.
- Allow you to classify the content in a post type. By default you have Tags and Categories.
- Examples: Project Types, Shirt Size.
- Can code yourself or use Custom Post Type UI plugin.
- My tutorial on Custom Taxonomies.
Custom Meta Boxes
- Great way to collect relevant information to be used by the theme.
- Examples: Clickthrough URL (for rotators), Client Name (for projects).
- You could just use the custom fields meta box, but creating your own is easier to use and less likely to break.
- Could code them yourself but difficult. I recommend using More Fields plugin.
- My tutorial for Meta Boxes is in the Custom Post Types post.
- Common need for CMS’s is multiple content columns.
- Common solutions: HTML in editor, sidebars, shortcodes, WYSIWYG meta box.
- My preferred solution: convert specific heading tag (e.g. h4) to div.
- Future improvements, content of h4 applied as class to the div.
- My tutorial for Multiple Content Areas
- Sidebars/Widgets are a wonderful, but often overused, feature. They are best used for content that is repeated often (not page-specific) and needs to be editable.
- Try and include as little code as possible in widgets, especially if you’re developing for a client.
- Use Widget Logic to limit a widget’s display using conditional logic.
- Use Widget Classes to add additional classes for styling.
- If a lot of code is need, build your own widget.
- My tutorials for creating Additional Sidebars and Creating a WordPress Widget.
- Use pre_get_posts to modify the Loop query. Ex: Customizing the WordPress Query
- Use new WP_Query() to create a new and separate query. Make sure to end it with wp_reset_postdata(). Ex: Custom WordPress Queries.
- Use get_posts() for simple queries. Ex: Post Thumbnails with Captions.
- If you need to stick any code inside a post, you should use a shortcode.
- Example: Adsense ads or form code.
- I also like to create shortcodes for template tags to be used in sidebars.
- My tutorials for Using Shortcodes and Shortcodes in Sidebar Widgets.