• Hi I am having trouble with a shortcode that pulls information from a Custom Post Type. A manage to pull the data, but all of it, however I am only wanting to extract a category of the custom post type.

    /* Insiders */

    register_taxonomy('insidersguidecat', 'insidersguide', array('hierarchical' => true, 'label' => __('Insiders Guide Categories'), 'singular_name' => 'Category'));
    }
    add_action('init', 'gr_post_type_insidersguide');

    /* Shortcode */ This shortcode draws the information.

    function gr_town($atts, $content = null) {
    extract(shortcode_atts(array(
                    "numposts" => '5',
    	), $atts));
    	query_posts('post_type=insidersguide&showposts='.$numposts);

    The code that doesn’t filter the information I want

    function gr_town($atts, $content = null) {
    extract(shortcode_atts(array(
                    "numposts" => '5',
    		"taxonomy_name" => "term_name"
    
    	), $atts));
    	query_posts('post_type=insidersguide&'.term_name.'&showposts='.$numposts);

    Any ideas?

The topic ‘Shortcode for Custom Post Type’ is closed to new replies.