We’ve been working a lot with WordPress as of late. It’s flexibility makes it a great candidate for many websites. In addition to its flexibility, the documentation in the WordPress Codex is above and beyond most open source products. Check out our breakdown of WordPress’ core Templating Concepts and our best practices.
We’ve been working a lot with WordPress as of late. It’s flexibility makes it a great candidate for many websites. In addition to its flexibility, the documentation in the WordPress Codex is above and beyond most open source products. Check out our breakdown of WordPress’ core Templating Concepts and our best practices.
In the tutorials below we cover WordPress best practices and the core concepts to help you figure out WordPress templating. Note that we don’t cover initial template creation in these tutorials.
Difference between Templates, Specialized Templates, and Partials
In this tutorial, we cover the difference between Templates and Partials and their use case scenarios. It is important to make code as reuseable as possible within a template; less is more! Check it out here.
Creating Custom Post Types
In this post, we explain why you should use Custom Post Types and why it helps the client organize their site better. There’s also a section on Custom Taxonomies which explains adding more ways to categorize or tag posts also. Check it out here.
Choosing Between get_posts() and other Listing Views (archive.php, taxonomy-$name.php, etc)
In this post we cover choosing between the different ways you can create a listings page/views.
In WordPress you can render listing pages in two ways:
- By using get_posts() or similar methods to create your own listing in a template
- By using existing WordPress template pages (archive-$name.php, taxonomy-$name.php, etc)
While using get_posts() allows for maximum flexibility, we should always note that WordPress does do a query for every page it renders; in other words, you can save an SQL query if you can modify it before it renders. Modifying the Loop query is also covered in this post. Check it out here.
Other WordPress and PHP Templating Tutorials
Adding CSS/JS to your Template
PHP array_chunk() for better nested Loops
PHP shorthand IF statements and example use cases
Displaying Subpages on a page using get_pages()
WordPress User Tutorials for adding content
Adding and Managing Images in WordPress
Let us know if you have other ideas or questions regarding WordPress Templating!