O'Reilly logo

WordPress Plugin Development Cookbook by Yannick Lefebvre

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying single custom post type items using custom templates

Custom post types straddle the line between plugin development and theme development since displaying any information that is specific to these new elements requires the creation of custom template files in the theme directory.

While it is not possible to create a solution that will work for all themes, a good practice that can be followed by plugin developers is to display the new data using the default WordPress theme. This way, users configuring the plugin on their site can see what needs to be done and adapt the code to their own theme.

This recipe shows how to create a template file to display all elements that we stored in the Book Review created in the previous recipe.

Getting ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required