apamphilon

Show all posts from a custom post type

<?php $the_query = new WP_Query( array( 'post_type' => 'services', 'posts_per_page' => -1 ) ); ?>           
<?php if ($the_query->have_posts()) : ?>                
    <ul>
        <?php while ( $the_query->have_posts()) : $the_query->the_post(); ?>
            <li>
                <a href="<?php the_permalink(); ?>">
                    <span class="title"><?php the_title(); ?></span>
                </a>
            </li>
        <?php endwhile; ?>
    </ul>
<?php endif; wp_reset_query(); ?>

Comments: