mardi 15 août 2017

Conditional Statement end if Not Calling

I was hoping someone would be able to look at my code and see why, my end while and end if's are not working before calling the end of and then the sidebar and footer. I've created a custom page template, and then I am using the JointsWP custom archive-loop-grid to call posts WP_Query'd by custom taxonomy field.

The entire custom taxonomy's code is below:

<?php /* Template Name:Meals */ ?>
<?php get_header(); ?>
        
        <div id="content">
        
                <div id="archive-content" class="row">
                    
<main id="main" class="large-10 medium-12 large-push-2 columns" role="main">
                    <h1 class="custom-page-title">Meals</h1>
                            <h2>Breakfast</h2>
                                <body>MIY firmly believes breakfast is the most important meal of the day! However, we understand it can be tough to fit in a proper breakfast on a busy schedule. That’s why we’ve developed these clean easy, protein packed, on-the-go solutions to start your day off right.</body>
                <section class="archive-content">
                    <?php
                        $args = array(
                            'post_type' => 'recipe',
                            'tax_query' => array(
                                array(
                                    'taxonomy' => 'course',
                                    'field'    => 'slug',
                                    'terms'    => 'breakfast',
                                ),
                            ),
                        );
                        $query = new WP_Query( $args ); ?>
                    <?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
                            <?php get_template_part( 'parts/loop', 'archive-grid' ); ?>
                    <?php endwhile; ?>
                        <!-- end of the loop -->
                        <?php wp_reset_postdata(); ?>
                    <?php else : ?>
                            <?php get_template_part( 'parts/content', 'missing' ); ?>
                    <?php endif; ?>
                </section>
                        </main> <!-- end #main -->

                    <?php get_sidebar(); ?>
                    
                </div> <!-- end #archive-content -->

        </div> <!-- end #content -->

<?php get_footer(); ?>

An image of what it page (http://ift.tt/2wMpXIQ) currently looks like and where the issue is in the inspector:

Archive (Not Working)

What it's meant to look like (a working archive page):

Archive (Working)

Aucun commentaire:

Enregistrer un commentaire