Taxonomy archive showing no results

Question

I have the file taxonomy-project.php and am trying to view results for some of my terms.

I keep getting a result of NO even though I have a post applied to that particular term.

taxonomy-project.php

<?php get_header(); ?>

    <section>
        <div class="container">
            <div class="row">
                <div class="col-12">

                    <?php if(have_posts()) : ?>
                        <div class="fancybox">
                            <div class="row">
                                <?php while(have_posts()) : the_post(); ?>
                                    YES
                                <?php endwhile; ?>
                            </div>
                        </div>

                    <?php else : ?>
                        NO
                    <?php endif; ?>

                </div>
            </div>


        </div>
    </section>


<?php get_footer (); ?>

Functions.php

    // register custom posts
add_action( 'init', 'create_post_type' );
function create_post_type() {
    register_post_type( 'work',
        array(
            'labels' => array(
            'name' => __( 'Work' ),
            'singular_name' => __( 'Work' ),
            'add_new_item' => __( 'Add New Work' ),
            'edit_item' => __( 'Edit Work' ),
            'new_item' => __( 'New Work' ),
            'view_item' => __( 'View Work' ),
            'search_items' => __( 'Search Work' )
            ),
            'public' => true,
            'exclude_from_search' => true,
            'menu_position' => 5,
            'supports' => array('title', 'thumbnail'),
            'taxonomies' => array('project')
        )
    );
}


// register custom taxonomies
 function taxonomyRegister_init() {
   // create a new taxonomy
   register_taxonomy(
     'project',
     'work',
     array(
       'label' => __('Project'),
       'sort' => true,
       'args' => array('orderby' => 'term_order'),
       'hierarchical' => true
     )
   );
 }
add_action( 'init', 'taxonomyRegister_init' );
0
pealo86 3 months 0 Answers 8 views 0

Leave an answer