Post Type Archive Descriptions

Description

Enables an editable description to display on post type archive pages. Show the description with WordPress’s the_archive_description() function that also displays taxonomy term descriptions. Will work automatically with many themes, including most default WordPress themes.

Translations: Archive descriptions are translatable via Polylang, WPML (affiliate link), and qTranslate-X.

The Events Calendar: The archive description is automatically added above the Events Bar when using the latest templates from The Events Calendar. Filter the location of the description or disable it entirely with the ptad_tribe_template_before_include filter.

Other Plugins by MRWweb

Screenshots

  • The editing interface for writing a post type archive description. This plugin adds the "Archive Description" link in the left menu, the "View Books Archive" link in the admin bar, and, of course, the field to save the description.

  • The post type archive description displayed (automatically!) in the Twenty Fifteen theme. The plugin also adds the "Edit Books Description" link in the Admin Bar.

Installation

  1. From your WordPress site’s dashboard, go to Plugins > Add New.
  2. Search for “Post Type Archive Descriptions.”
  3. Click “Install.”
  4. Click “Activate.”
  5. Depending on your theme, you may need to add the_archive_description() to your templates in order for it to work.

FAQ

Is this plugin compatible with WordPress 5.0 / “Gutenberg”?

Yes. The plugin does not directly integrate with the post editor screen so no changes were required.

Be aware that as of 5 Dec 2019, it appears the Twenty Nineteen theme will not support post type archive descriptions by default. Unless something changes, you will need to manually add support for them in a child theme if using Twenty Nineteen. See the next FAQ for how to do that.

How do I display a custom post type’s description?

Use the_archive_description() or get_the_archive_description().

Chances are you want this in the archive-{post_type_slug}.php or archive.php template files.

As of v1.3.0 of this plugin, the archive description is automatically added to The Events Calendar archive pages using the plugin’s latest design.

Which post types get a description?

By default, any custom post type excluding Posts and Pages that was registered with 'has_archive' => true. There is a filter (see below) to add support for any post type.

How do I set up an editable description for my Blog / Posts?

Since this plugin does not support descriptions for Posts or Pages, I recommend a different approach.

First make the blog page (aka the “Page for Posts”) editable with this snippet in functions.php or an mu-plugin:

add_filter( 'replace_editor', 'ptad_enable_gutenberg_editor_for_blog_page', 10, 2 );
/**
 * Simulate non-empty content to enable Gutenberg editor on the Blog page
 *
 * @param bool    $replace Whether to replace the editor.
 * @param WP_Post $post    Post object.
 * @return bool
 *
 * @see https://wordpress.stackexchange.com/a/350563/9844
 */
function ptad_enable_gutenberg_editor_for_blog_page( $replace, $post ) {

    if ( ! $replace && absint( get_option( 'page_for_posts' ) ) === $post->ID && empty( $post->post_content ) ) {
        // This comment will be removed by Gutenberg since it won't parse into block.
        $post->post_content = '<!--non-empty-content-->';
    }

    return $replace;

}

Then output that content on the blog page with the home.php template:

echo '<div class="archive-description blog-description">' . apply_filters( 'the_content', get_the_content( null, false, (int) get_option( 'page_for_posts' ) ) ) . '</div>';

Are there filters & actions to modify the plugin?

Yes. Plenty!

Filters:

  • ptad_post_types – specify the post types with a description (default is all non-built_in post types where has_archive is true)
  • ptad_admin_title – Modify admin page title
  • ptad_admin_parent – Change parent page of the Description edit page
  • ptad_menu_label – Modify the menu item label in the admin
  • ptad_description_capability – Set capability of who can edit descriptions. Default: edit_posts
  • ptad_edit_description_link – Modify admin bar link to edit the description
  • ptad_view_archive_link – Modify admin bar link to view the post type archive
  • ptad_tribe_template_before_include – Modify which The Events Calendar template part the description should appear before, or false to disable automatic output.

Actions:

  • ptad_before_editor – Between title and description editor for ALL admin pages. Receives $post_type arg.
  • ptad_before_editor_{post_type} – Between title and description editor for any specific post type.
  • ptad_after_editor – Immediately below description editor for ALL admin pages. Receives $post_type arg.
  • ptad_after_editor_{post_type} – Immediately below description editor for any specific post type.

Reviews

أبريل 1, 2019
This is such an elegant way to present your users with the option of editing the text of your archives. I simply installed it and after modifying my theme a bit, I was up and running. Fantastic idea, thank you and keep up the good work!
يناير 18, 2018
A useful and well implemented plugin. If you're going to use any other post-type global fields it's better to replace this plugin with a custom field and put all of those on a single options page, but otherwise it does its job well.
Read all 5 reviews

Contributors & Developers

“Post Type Archive Descriptions” is open source software. The following people have contributed to this plugin.

Contributors

“Post Type Archive Descriptions” has been translated into 3 locales. Thank you to the translators for their contributions.

Translate “Post Type Archive Descriptions” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.3.0 (February 6, 2020)

  • [NEW!] Support for Polylang and WPML translations
  • [NEW!] Automatically add archive description to The Events Calendar plugin’s archive pages (Month, List, Week, Map, etc.)
  • [Fix] Resolve warnings on Event Category pages when using The Events Calendar or other similar situations
  • [Dev] Reorganize code

1.2.0 (October 3, 2020)

  • [Fix] Now supports post types in admin submenus other than the default. Big props to Jeremy Carlson, @jcdesign
  • [Fix] Get correct description and don’t show warning on a Post Type Archive that shows multiple post types (probably via pre_get_posts)
  • [Dev] Code cleanup