You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Rendering Information
When developing custom plugins, there may be instances where you need to render information on the front end of a WordPress site.
In this lesson, you'll learn about some common ways to implement rendering of information from a plugin.
## Theme template
As you learned in the [What is a plugin](01-what-is-a-plugin.md) lesson, a WordPress plugin adds new features or functionality to a WordPress site.
The most common way to display information from WordPress is to use specific theme template files.
For example, in the bookstore example plugin, you created a custom post type for books.
You could then create custom templates like an `archive-book.html` or `single-book.html` in the theme to render the books archive or an individual book's information.
Depending on what you are working on will determine how you implement this:
- If you're working on a custom site that you have full control over, and you're also building a custom theme, you can add these templates to the theme
- If you're working in customising an existing theme, you can add these templates to a child theme
Developing custom templates is outside the scope of this lesson, but you can learn more about this in the [Theme Developer Handbook](https://developer.wordpress.org/themes/), and more specifically the [Templates](https://developer.wordpress.org/themes/templates/) section of that handbook.
You can also watch the "An introduction to developing WordPress themes" module in the Beginner Developer Learning Pathway as well as the Intermediate Theme Developer Learning Pathway to learn more about developing custom themes and theme templates.
## Custom Templates in the Site Editor
It is also possible to create a custom template in the Site Editor.
When you register a custom post type, the Site Editor offers you the option to create templates for that custom post type.
For example, with your book custom post type enabled, navigating to the Templates section in the Site Editor and clicking Add New Template will give you options to add new archive and single item templates for your book.
You can then use the Template Editor to create and edit these templates.
For example, with a Single Book template created and saved, viewing the book post type in the front end of the site will use the Single Book template to render the book information.
## Custom Blocks
Another way to render information from a plugin is to use custom blocks.
Blocks are modular components used to compose and format content in a WordPress site, and are used to create rich and flexible layouts for post, pages, and just about any other WordPress content.
You could develop a custom block to render information from your plugin, which the users of your plugin could then implement in their own posts, pages, or custom templates.
You will learn more about blocks in the Introduction to WordPress Blocks section of the Beginner Developer Learning Pathway.
Picking up the draft above, I filled out the remaining sections (Custom Templates in the Site Editor, Custom Blocks, Custom Shortcodes, Template Tags, Hooking into Post Content) and added a code example to each, all using the same bookstore/book CPT from the earlier draft. A couple of small corrections along the way: the classic theme-template section uses .php rather than .html (that's the block-theme/Site Editor convention, covered in its own section below), and the shortcode example uses meta_query instead of the older top-level meta_key/meta_value.
Happy to adjust scope, trim, or split this into two lessons if that fits the pathway's outcome-count convention better. Flagging that as an open question rather than a decision I made unilaterally.
Activity
[-]Rendering information[/-][+]Rendering plugin data[/+]jonathanbossenger commentedon Feb 11, 2024
Initial draft script:
melbos commentedon Aug 6, 2026
Picking up the draft above, I filled out the remaining sections (Custom Templates in the Site Editor, Custom Blocks, Custom Shortcodes, Template Tags, Hooking into Post Content) and added a code example to each, all using the same bookstore/book CPT from the earlier draft. A couple of small corrections along the way: the classic theme-template section uses
.phprather than.html(that's the block-theme/Site Editor convention, covered in its own section below), and the shortcode example usesmeta_queryinstead of the older top-levelmeta_key/meta_value.Full script: https://github.com/melbos/intermediate-plugin-developer-lessons/blob/main/lessons/13-rendering-plugin-data.md
Happy to adjust scope, trim, or split this into two lessons if that fits the pathway's outcome-count convention better. Flagging that as an open question rather than a decision I made unilaterally.