• Resolved googie

    (@googie)


    I am using custom post type UI plugin and I want to add custom post type of ‘formules’ in the loop on my front page, but every time I try to add I get a blank page. I also want to add more than one custom post types to the loop. I am not sure what I am getting wrong and I would appreciate some help.

    My code is:

    <?php if ( have_posts() ) : ?>
    <?php /* Start the Loop */ ?>
    <?php
    $query = new WP_Query( array( 'post_type' => array( 'formules' ), 'tag__not_in' => array( 20 )) )
    while( $query->have_posts() ):
    $query->the_post();
    
    get_template_part( 'content', get_post_format() );
    ?>
    
    <?php endwhile; ?>
    
    <?php googie_theme_paging_nav(); ?>
    
    <?php else : ?>
    
    <?php get_template_part( 'content', 'none' ); ?>
    
    <?php endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • You forgot to put a semicolon at the end of this line, that may be the problem:

    $query = new WP_Query( array( 'post_type' => array( 'formules' ), 'tag__not_in' => array( 20 )) )
    Thread Starter googie

    (@googie)

    Thanks that did the trick, the simplest thing overlooked!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Add custom post type to the loop (Underscores theme)’ is closed to new replies.