Skip Navigation

[Resolved] How show custom post type description in frontend?

This support ticket is created 7 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 4 replies, has 2 voices.

Last updated by Aldo 7 years, 6 months ago.

Assisted by: Konstantinos Galanakis.

Author
Posts
#446291

I am trying to: To return the Custom Post Type description in the frontend.
Is there a function or shortcode?
Can Descriptions be translated as well?

Thanks,
Aldo

#446531

Hello.

Thank you for contacting the Toolset Support.

In order to be able to answer this question properly, I need to know where exactly you want the Custom Post Type description to appear. You want it displayed in a View or in a Content Template?

About the translation of the custom post type description, you can do it using WPML but for further queries, regarding translation issues, you'll have to contact WPML support here https://wpml.org/forums/forum/english-support/

If you have any further issues, please let me know.

Regards

#446544

Hello

In a Template.

Thanks
Aldo

#446552

Hello.

In order to achieve this, you need to create a custom shortcode.

Insert the following code into your functions.php, that creates the shortcode.

// Add Shortcode [get_post_info post_type="[wpv-post-type show='slug']" attribute="description" ]
function get_post_type_info( $atts ) {

    // Attributes
    $attri = shortcode_atts(
        array(
            'post_type' => '',
            'attribute' => '',
        ), $atts );

    // Code
    $obj = get_post_type_object( $attri["post_type"]);

    $array = get_object_vars($obj);

    return $array[$attri['attribute']] ;
}
add_shortcode( 'get_post_info', 'get_post_type_info' );

Now, inside your Content Template use the following shortcode

[get_post_info post_type="[wpv-post-type show='slug']" attribute="description" ]

If this doesn't resolve your issue or you have any further issues or questions, please let me know.

Regards

#446665

Perfect, thanks!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.