OGO
(Ben)
1
Hi,
Easy for me to build grid / themes using shortodes.
I use this page with lot of references :
I am now building a new search result page and I would like to display the kind of content just bellow the title of the content.
So I can use :
[wpbb post:title]
But I have no idea how to display the kind of content.
I have:
- Articles
- Pages
- Events (Event Calendar Pro)
- and many different CPT built with Pods
How to display them : -CPT1- -CPT2 -CPT3- etc.
Hope someone can help.
pross
2
So you just want to display the post type label?
OGO
(Ben)
3
If Article - Page - Event - CPTName is post type label for a content, yes this is what I need to display.
Thank you
pross
4
You just need to create a shortcode for it.
add_shortcode( 'get_post_type', function() {
$result = get_post_type_object( get_post_type() );
return $result->labels->singular_name );
});
OGO
(Ben)
5
@pross
Thanks for your answer. Really helpul !
It works well but I had to make a correction based on my editor error check.
add_shortcode( 'get_post_type', function() {
$result = get_post_type_object( get_post_type() );
return $result->labels->singular_name ;
});
Last question : any chance to make this post type label a link to all other content of this kind ?