Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i have created a custom post type called directory, on my directory page which lists my directories i have a sidebar which shows the categories and how many are in a category but when i click one of them to go to the category it goes to category.php and says there was no results when there should be. i have tried using category-directory.php , directory-category.php , archive-directory.php , taxonomy-directory.php but none of these work how could i make this work? here is my directory.php file

                <div id="map" class="map start-small map-small">
                    <div id="innerMap" class="innerMap"></div>
                    <div id="grow-map" class="grow-map">
                        <div class="show-hide"></div>
                    </div>
                </div>

                <div class="main group">
                    <div id="main-container" class="main-container center-content events" role="main">
                        <div class="page">

                            <div class="sidebar" id="sidebar">
                                <?php
                                $subcategories = get_categories('&child_of=98&hide_empty&orderby=ASC&pad_counts=1'); 
                                echo '<ul class="sub-cats">';
                                ?><h3>Directories</h3><?php
                                foreach ($subcategories as $subcategory) {
                                  echo sprintf('<li><a href="%s">%s</a></li>', get_category_link($subcategory->term_id), apply_filters('get_term', $subcategory->name) . " ( " . $subcategory->category_count . " ) "   );
                                }
                                echo '</ul>';
                                ?>
                            </div>
                            <div class="content-area" id="content_area">
                                <h2 class="page-header">
                                <?php
                                the_title();
                                ?>
                                </h2>
                                <div class="directories-listing columns three group">
                                <?php query_posts(array( 'post_type' => 'directory', 'posts_per_page' => '0' ,'orderby' => 'date','order' => 'DESC' ) );?>          
                                    <?php while (have_posts()) : the_post();?>
                                        <div class="single-directory column">
                                            <img src="<?php if(get_field('logo')) {the_field('logo');} else {?><?php bloginfo('template_url'); ?>/images/placeholder.jpg<?php } ;?>" alt="<?php the_title();?>" />
                                            <a href="<?php the_permalink();?>"><h5><?php the_title();?></h5></a>
                                            <a href="<?php the_field('website');?>"><p><?php the_field('website');?></p></a>
                                            <p><?php content('30');?></p>
                                        </div>
                                    <?php endwhile;?>
                                <?php wp_reset_query(); ?>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>

            <?php include(TEMPLATEPATH . '/footer-page.php'); ?>

Also does anyone know how i could add a search form to search only my custom post type?

any help would really be appreciated

share|improve this question
1  
Have a look at this post: wordpress.stackexchange.com/questions/130259/…. This should help you. –  Manolo Feb 7 at 11:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.