Group Admins

WordPress Troubleshooting and Support

Public Group active 1 year, 1 month ago ago

WordPress support from our community

Custom Post Types and Shortcodes

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #1170

    Hello everyone,

    I am running into a problem with Custom Post Types and Shortcodes.
    The problem is that shortcodes will not show up when i use them in a CPT. Why?

    I found some thing about adding add_filters(); on the codex but it seems that it not working.

    Can someone give me another direction or point me to a place that may have a solution.



    I don’t think there’s anything special about custom post types and shortcodes. I just did a quick test with the following code and it worked fine on one of the videos on this site, which is a CPT:

    function sfire_shortcode_example() {
    return ‘This is a sample of a shortcode.‘;
    add_shortcode(‘sampleshortcode’, ‘sfire_shortcode_example’);

    Here are the args for the post type, which may help you:

    $args = array(
    ‘labels’ => $labels,
    ‘public’ => true,
    ‘publicly_queryable’ => true,
    ‘show_ui’ => true,
    ‘show_in_menu’ => true,
    ‘query_var’ => true,
    ‘rewrite’ => true,
    ‘capability_type’ => ‘post’,
    ‘has_archive’ => true,
    ‘hierarchical’ => false,
    ‘menu_position’ => 5,
    ‘supports’ => array(‘title’,’editor’,’custom-fields’,’revisions’,’comments’),
    ‘taxonomies’ => array(‘category’,’post_tag’)



    Thanks for the response. I realized that i was using the_excerpt(); instead of the_content(); to output the info and of course that would not work.

    Thanks for your time

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.