WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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-name"><a href="' . get_permalink() . '"'; 
  echo ' title="' . get_the_title() . '">' . get_the_title() . '</a></div>';
  echo '</div>';
share|improve this question
What have you tried so far. Your question doesn't show any effort or research. Please edit your question and add some code that is relevant to your question – Pieter Goosen Apr 9 '14 at 19:51
Pieter, I have updated my question. – David McKinlay Apr 9 '14 at 20:01
This is the code to register the custom post type, do you have any code from your attempts to display the thumbnail on the publicity page? – Stephen S. Apr 9 '14 at 20:26
@PieterGoosen Please don't use backticks for highlighting those are for code, I saw this on your suggested edit, using them for other things then code messes up the search functionality. – ialocin Apr 9 '14 at 20:50
@PieterGoosen Sure, my pleasure, it is not like I knew that in the beginning, I got pretty much the same remark. – ialocin Apr 9 '14 at 21:27

It sounds like you're wanting the page you are redirected to to display the CPT's information in a certain way or format, in which case you'll want to create a single page template for the custom post types you've created.

You can use the single.php file as an example for the layout and customize it as necessary, but the name of the file should be single-publicity.php and single-management.php.

I hope that helps!


I forgot to mention, I don't know what the name of the page is that you're looping the CPTs through, but make sure the permalinks don't conflict (e.g. a page called Publicity with a slug of publicity).

share|improve this answer
Thanks Oturia, I will give this a go later this evening. – David McKinlay Apr 10 '14 at 11:39
Thanks for the help, works a charm! – David McKinlay Apr 10 '14 at 16:39
You're most welcome, sir! – Oturia Apr 12 '14 at 22:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.