Custom post types & Thumbnails
I am looking to set up 2 custom post types - Publicity Management
What I would like to do is display the featured thumbnail for each post from the custom post type on the Publicity page. These will then link though to each post using a custom template.
I would like to do the exact same for the Management section. I have created the post type, but when I click on the thumbnails I am being taken to a page that doesn't contain any of the relevant info.
I am using a child theme of Twenty Twelve.
Can someone please help with this?
Code used for cpt registration
add_action('init', 'publicity_register');
function publicity_register() {
$labels = array(
//the (probably plural) name for our new post type
'name' = _x('Publicity', 'post type general name'),
//how you’d refer to this in the singular (such as ‘Add new ****’)
'singular_name' = _x('Publicity', 'post type singular name'),
'add_new' = _x('Add New', 'publicity'),
'add_new_item' = __('Add New Publicity Artist'),
'edit_item' = __('Edit Publicity Artist'),
'new_item' = __('New Publicity Artist '),
'view_item' = __('View Publicity Artist'),
'search_items' = __('Search Publicity'),
'not_found' = __('Nothing found'),
'not_found_in_trash' = __('Nothing found in Trash'),
'parent_item_colon' = ''
);
$args = array(
'labels' = $labels,
'public' = true,
'show_ui' = true,
'capability_type' = 'post',
'hierarchical' = false,
'rewrite' = true,
'supports' = array('title', 'editor', 'thumbnail'),
'has_archive' = true,
);
register_post_type( 'publicity' , $args );
}
Code used for loop
$args = array( 'post_type' = 'publicity', 'posts_per_page' = 20 );
$loop = new WP_Query( $args );
while ( $loop-have_posts() ) : $loop-the_post();
echo 'div class=col-md-3 portfolio-item';
echo 'a href=' . get_permalink() . ' title=' . get_the_title() . '';
echo get_the_post_thumbnail() . ' /a';
echo 'div class=artist-namea href=' . get_permalink() . '';
echo ' title=' . get_the_title() . '' . get_the_title() . '/a/div';
echo '/div';
endwhile;
?
Topic post-type-support custom-post-types Wordpress
Category Web