I'm using the_title() to show the title of a custom post type, but it's not working; the title does not show.

$wp_query = new WP_Query();
$wp_query -> query('post_type=press&showposts=20');
while ($wp_query->have_posts()) : 
    $wp_query->the_post(); ?>
    <div class="press-item">
        <div class="press-img"><?php the_post_thumbnail('medium');?></div>
        <div class="press-content">
            <div class="press-title"><?php the_title(); ?> </div>
            <div class="press-excerpt"><?php the_excerpt(); ?> </div>
<?php endwhile;

1 Answer 1


Try this as your query:

$args = array(
    'post_type'      => 'press',
    'posts_per_page' => 20

$wp_query = new WP_Query( $args );

while // etc. 

Also you could try:

<div class="press-title"><?php echo get_the_title(); ?> </div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.