Answer the question
In order to leave comments, you need to log in
How to make it possible to add a link to the post type archive in the menu?
I say right away that I have never developed on Wordpress, but now I had to help people.
There are several custom types of posts in the admin panel, and you can add a link to an archive of a particular type in the menu by selecting the post type, the All tab and there "All positions":
But for one of the custom types there is no such item! There are only individual entries.
It didn't have a post archive page, so I added its initialization in the same way that other types are added:
function create_post_type_doctors() {
register_post_type( 'doctors',
array(
'labels' => array(
'name' => __( 'Doctors' ),
'singular_name' => __( 'doctor' )
),
'public' => true,
'has_archive' => true,
'has_archive_slug' => '',
'show_in_menu' => true,
'show_in_menu_page' => '',
'show_ui' => true,
'publicly_queryable' => true,
'can_export' => true,
'show_in_nav_menus' => true,
'query_var_enabled' => '1',
'query_var' => true,
'permalink_epmask' => 1,
'rest_base' => 'services',
'exclude_from_search' => false,
'hierarchical' => false,
'show_in_rest' => false,
'menu_icon' => 'dashicons-clipboard'
)
);
}
add_action( 'init', 'create_post_type_deals_doctors' );
Answer the question
In order to leave comments, you need to log in
It turned out that this type of post is already added automatically by some plugin from the database. Everything was configured in the admin panel in Toolset->Types of publications.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question