display custom post type from register taxonomy
-
Hi Everybody,
I’ve created a custom post type via this function:
function custom_post_type() { $labels = array( 'name' => _x( 'advertising type', 'Post Type General Name', 'twentythirteen' ), 'singular_name' => _x( 'advertising type', 'Post Type Singular Name', 'twentythirteen' ), 'menu_name' => __( 'advertising type', 'twentythirteen' ), 'parent_item_colon' => __( 'Parent advertising', 'twentythirteen' ), 'all_items' => __( 'All advertising', 'twentythirteen' ), 'view_item' => __( 'View advertising', 'twentythirteen' ), 'add_new_item' => __( 'Add New advertising', 'twentythirteen' ), 'add_new' => __( 'Add New', 'twentythirteen' ), 'edit_item' => __( 'Edit advertising', 'twentythirteen' ), 'update_item' => __( 'Update advertising', 'twentythirteen' ), 'search_items' => __( 'Search advertising', 'twentythirteen' ), 'not_found' => __( 'Not Found', 'twentythirteen' ), 'not_found_in_trash' => __( 'Not found in Trash', 'twentythirteen' ), 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_status' => 'inherit', 'post_mime_type' => 'image', ); $args = array( 'label' => __( 'advertising', 'twentythirteen' ), 'description' => __( 'advertising news and reviews', 'twentythirteen' ), 'labels' => $labels, // Features this CPT supports in Post Editor 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ), 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'has_archive' => true, 'taxonomies' => array('category', 'post_tag') ,// this is IMPORTANT 'capability_type' => 'page', ); register_taxonomy( 'advertising_type', 'advertising', $args ); register_post_type( 'advertising', $args ); } add_action( 'init', 'custom_post_type', 0 ); Which include a taxonomy "advertising_type" In my loop, I've ad the query post to display only post from a specific taxonomy: <?php global $wp_query; $args = array_merge( $wp_query->query_vars, array('post_type' => 'advertising', 'posts_per_page' => 50, 'advertising_type' => 'recruitment', ) ); query_posts( $args ); while(have_posts()): the_post(); ?> <?php while ( $folio_loop->have_posts() ) : $folio_loop->the_post(); ?> <?php endwhile; ?>
which is recruitment using:
'advertising_type' => 'recruitment'
However . . . I don’t manage to make it work . . it doesn’t display any post . . . If i delete this query I have the post from my custom post type display, so I imagine the problem is really coming from this ( That I can not display post from a specific taxonomy)
Any helps would be amazing,
thank you for your time and help guys
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘display custom post type from register taxonomy’ is closed to new replies.