Answer the question
In order to leave comments, you need to log in
How to display posts of a custom post type?
Created a costume type for Recipes ( recipes ), but it gives an error when outputting
<?php
$args = array( 'post_type' => 'movies', 'posts_per_page' => 10 );
$the_query = new WP_Query( $args );
?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<h2><?php the_title(); ?></h2>
<div class="entry-content">
<?php the_content(); ?>
</div>
<?php wp_reset_postdata(); ?>
<?php else: ?>
<p><?php _e( 'Записи не найдены.' ); ?></p>
<?php endif; ?>
Parse error: syntax error, unexpected 'else' (T_ELSE) in /home/zhevzhik/carpathians.rest/super-grill/wp-content/themes/online-store-grills/archive-recipes.php on line 24
Answer the question
In order to leave comments, you need to log in
I won't ask why you have the type recipes , and at the same time 'post_type' => 'movies'
, but you missed endwhile;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question