Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I created a custom post type with name career. I would like to know what's the best way to list the posts. I created a page template with a query inside, but the pager is invisible. I don't know what's wrong.

<table id="career">
            <tr>
                <td>Position</td>
                <td>Location</td>
                <td>Close date</td>
                <td>View details</td>
                <td></td>
            </tr>
        <?php $mypost = array( 'post_type' => 'career', );
        $loop = new WP_Query( $mypost ); ?>
        <?php while ( $loop->have_posts() ) : $loop->the_post();?>
        <?php 
            $custom = get_post_custom($post->ID);
            $location = $custom["location"][0];
            $close_date = $custom["close_date"][0];
        ?>
        <tr id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
            <td><?php the_title(); ?></td>
            <td><?php echo $location; ?></td>
            <td><?php echo $close_date; ?></td>
            <td><a href="<?php the_permalink(); ?>" title="Details">> Details</a></td>
            <td></td>
        </tr>
        <?php endwhile;  ?>
        <div class="nav-previous"><?php next_posts_link( '<span class="meta-nav">&larr;</span> Older'); ?></div>
        <div class="nav-next"><?php previous_posts_link( 'Newer<span class= "meta-nav">&rarr;</span>' ); ?></div>
        </table>

How do you list your custom post types with pager?

share|improve this question
add comment

1 Answer

Refer to the Template Hierarchy Codex entry.

For your pagination issues with a custom query loop, look for related questions on the site.

share|improve this answer
    
What do you think about creating page template instead of archive-...php? I prefer that because my client can edit the content above the career, and he can use any url/title. Or this method is not recommended? –  robert Feb 24 '13 at 21:56
add comment

Your Answer

 
discard

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.