For each cpt archive page, I would like to include the cpt description below the archive title.
Is there any documentation that you are following?
I have tried the following old cases but none of them has worked.
https://toolset.com/forums/topic/how-show-custom-post-type-description-in-frontend/
https://toolset.com/forums/topic/custom-post-type-description/#post-374182
Is there a similar example that we can see?
What is the link to your site?
hidden link
It is a dev site so you need the following details for access
user: janne
pw: Lvt@1527
Best regards / jan
Hi,
Thank you for contacting us and I'd be happy to assist.
I was able to make the code from Minesh's reply work, after slight adjustment.
( ref: https://toolset.com/forums/topic/custom-post-type-description/#post-374182 )
function get_post_desc( $atts,$content ) {
global $wp_post_types;
global $WP_Views;
$post_type = $WP_Views->post_query->query['post_type'];
$obj = $wp_post_types[$post_type];
return $obj->description;
}
add_shortcode( 'get_cpt_desc', 'get_post_desc' );
Next, I added some description text, in the "Books" CPT settings on my test website.
( screenshot: hidden link )
And in the WordPress Archive for the Books CPT, I included the shortcode like this:
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Hi Waqar,
Many thanks for superfast response. And it works perfectly.
Have a nice week.
Best regards / jan