Support » Fixing WordPress » Listing posts from a custom post type

  • Resolved velocitykendal


    Hello there,

    This feels like a really dumb question yet I haven’t managed to resolve it yet:

    I’ve created a custom post type, given it some custom taxonomies and all’s good. I can view a post using utilising the single-******.php template and have set up a taxonomy.php template fine. But I can’t seem to work out how to view a list of posts from the new post type.

    I have normal posts pointing to a page on the site and would like to keep those separate. So I want to point a menu item to a directory that will list the custom posts in the same way. – works fine, returns a post. – results in a 404 error.

    I don’t know how to assign a template to the above directory?

    Can anyone help?



Viewing 2 replies - 1 through 2 (of 2 total)
  • Yes I know the problem. It is not too hard to solve, but every time a new thing appears. In my case the ‘previous’ and ‘next’ links don’t work and I can’t get the custom taxonomies to work. One thing at a time though 🙂
    I have the idea that the custom post types have been implemented just half. There is a plugin that claims to fill the gaps:
    It requires PHP5 and in my case, does not exactly do what it promises, but maybe you have more luck.

    If not, here’s how to make an index for your custom post types:
    Take the index.php of your theme and replace the loop

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    by this:

    $args = array(
    	'posts_per_page' => 100,
    	'post_type' => 'blog'
    if ( have_posts() ) : while ( have_posts() ) : the_post();

    my custom post type is called “blog” and I have 100 posts per page because the navigation does not work.

    Save the file as “blog.php” (or something) and upload it to the folder of your active theme.

    Then you go to WP, create a new page and assign the template “blog.php” to it and publish.

    Yeah thanks for that, that’s (the latter) done the job. Luckily I don’t need to use pagination in this instance.



Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Listing posts from a custom post type’ is closed to new replies.