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

My problem is to display the content of custom post types. The Dashboard-preview shows the right content (/vita/vita-test/), but I can't see it at the homepage ( /vita/ ). It displays the content of index.php Why isn't found „vita-test“?

My permalink is /%post_id%/%postname%/

my post type $args

'rewrite' => array("slug" => "vita"),
'show_in_nav_menus' => true

I also use

if ( have_posts() ) : while ( have_posts() ) : the_post(); 

Do you have an idea where my mistake is?

Thanks so much!

share|improve this question

You need to register you post type with the has_archive argument to get an archive page at /<post_type_slug>/.


add_action('init', 'wpse70469_register');
function wpse70469_register()
    $args = array(
        'rewrite' => array("slug" => "vita"),
        'show_in_nav_menus' => true,
        'has_archive' => true, // this makes the archive page work.

    register_post_type('wpse70469_type', $args);

You might want read through the arguments for register_post_type. You also don't need to include query posts like that. WordPress will setup the correct post type and status based on the current request -- no need to do that manually.

share|improve this answer
in addition, it's probably worth mentioning that calling query_posts is neither required nor recommended – Milo Oct 25 '12 at 16:13
Thanks for the super quick response! I have register post type 'has archive' from the beginning - Any other idea where my mistake is? – papaver Oct 25 '12 at 16:30
Post more of your loop code. the_post doesn't out put anything. the_content will. – chrisguitarguy Oct 26 '12 at 0:58

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.