How to detect when get_template_part() WordPress function fails

Nowadays, in most of modern WordPress themes, the function get_template_part() is one of their essential elements. It just takes review the structure of, for example the last official themes (…, Fourteen, Fifteen, Sixteen), to realize that WordPress themes have evolved, from a structure quite monolitic to a structure driven by content and formats. And one of the keys to this evolution is the get_template_part () function.

silent diversity

get_template_part() it’s actually an invaluable element of any modern WordPress theme that through its two parameters allows us to select dynamically what .php file (what part) is going to be loaded for displaying the current page (see the official documentation for further information) however, one of its characteristics is that Continue reading…

Using Post Formats with your custom WordPress Post Types

Since versión 3.1, WordPress introduced a new theme feature called Post Formats that, basically, allows us to divide a regular WordPress Post Type in subsets based on the nature of the information that a post includes, ie, you can have regular posts, but you can also have posts that specifically contain a video, or an image, etc. In case of the Post Type post, most of the popular WP themes already includes support for styling its Post Formats but, what can we do for using Post Formats in case of our custom Post Types?

macarons

The proposed method is quite easy and it simply extends the habitually used technic for dealing with Post Formats inside WordPress templates, in other words, we’ll create a refined system for loading the content-{$post_format_slug}.php subtemplates. Continue reading…

Using the Post Type description in WordPress Themes

Sometimes, especially in the case of an items list, apart from the header/title of the list, we would want to add some text as an introduction for these items: a global suggestion, perhaps a couple of interesting links, a descriptive or in detail approach about the items, a definition, etc. When the items to list are inside a Category or a Tag, to add a header with description is obvious because, simply taking a look to the screen for editing terms, all of us know that they have a description but, do you know that post types have also got a description, and that you can use it in your themes?

An example of using the Post Type description in WordPress Themes

Yes, in the same way that with the terms of a taxonomy, WordPress Post Types have also got a field to add a description thus, you can use this property of the Post Type object to introduce any text that you want and Continue reading…