In this post, i’ll show you how to add any type of unique content to any excerpt or teaser on any archive page.
This solution uses the native custom fields meta box already included in WordPress.
You can position the content anywhere on the archive page including:
- Before the entry title
- After the entry title Before the post info
- After the post info
- Before your excerpt of teaser
And here’s one result showing HTML added to the custom fields meta box displaying before the excerpt on the home page.
Here’s the PHP code. Please copy ALL the code from the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++
The above code will display your content after the entry title and post info but before the excerpt or teaser.
Simply change the 3rd parameter in the action to 11 if you want to display your content before the post info.
The code hooks into the genesis_entry_header hook using a custom field named after-title.
All you need to do is add unique content using the native custom fields meta box on each Edit screen.
Here’s an example of the single post content which is displayed as a teaser or excerpt on the archive page depending what your theme offers.
Add a Custom Meta Box
Rather than use the native custom fields meta box, you could also hand code a custom meta box and hook it into the edit_form_after_title hook which will display it before your editor and after your title on the Edit screens for posts and pages.
Another option is to install a plugin like Advanced Custom Fields which enables you to create meta boxes without needing any knowledge of PHP coding.Subscribe for new Genesis Tutorials