开发者 |
mrwweb
tusko-trush jcdesign |
---|---|
更新时间 | 2022年6月21日 23:43 |
捐献地址: | 去捐款 |
PHP版本: | 4.6 及以上 |
WordPress版本: | 6.0 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
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
the_archive_description()
to your templates in order for it to work.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.
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.
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.
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 );
/**
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>';
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 titleptad_admin_parent
- Change parent page of the Description edit pageptad_menu_label
- Modify the menu item label in the adminptad_description_capability
- Set capability of who can edit descriptions. Default: edit_posts
ptad_edit_description_link
- Modify admin bar link to edit the descriptionptad_view_archive_link
- Modify admin bar link to view the post type archiveptad_tribe_template_before_include
- Modify which The Events Calendar template part the description should appear before, or false
to disable automatic output.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.