Support » Fixing WordPress » Default page for custom post type

  • jepser


    As you know, category.php is the default list for categories, I mean if I want to check all posts of a category, category.php handles it.

    Also with tag.php, author.php, taxonomy.php them show all the posts depending of the criteria. So what name a have to use if I want to display all post of a custom post type?
    post-type-name.php ? with a loop like category.php?

Viewing 2 replies - 1 through 2 (of 2 total)
  • well, to show all posts in a custom post type, you make a page template.

    I made a copy of my index.php, named in shop.php (since mine is for a shop) and put this in fron of the loop:

    query_posts( array(
    	// Set post type
    	'post_type' => 've_products',
    	// Enabled paging
    	'paged'=> ( get_query_var('paged') ? get_query_var('paged') : 1 ),

    my post type was ve_products

    you can use single-posttype.php to display the single view of your custom post type, if you want it to be styled differently than normal posts. Otherwise it will use your standard single.php

    then make a new page in WP’s page editor, and assign it the template you just made with the custom query.



    thanks dude, I think I will do that, I mean I didn’t want to make that just imagine that your developing a wp theme that is for sale and the user can registar N quantity of post types, and the client insn’t an expert in php.

    But thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Default page for custom post type’ is closed to new replies.