Display recipe categories if on recipes page.
authorLaury GvR <laury@gaslightmedia.com>
Wed, 3 Jun 2015 19:54:48 +0000 (15:54 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Wed, 3 Jun 2015 19:55:06 +0000 (15:55 -0400)
page.php

index 6ab858f..78521d9 100644 (file)
--- a/page.php
+++ b/page.php
@@ -8,11 +8,38 @@
         </div> 
         <div class="row">
             <div class="small-12 columns">
-                    <?php if(have_posts()) : while(have_posts()): the_post();?>
-                    <?php the_content();?>
-                    <?php endwhile; else:?>
-                    <p><?php _e('Sorry, no posts yet');?></p>
-                    <?php endif;?>
+                
+                    <?php if (is_page('Recipes')) { ?>
+                        <?php
+                        //list terms in a given taxonomy using wp_list_categories  (also useful as a widget)
+                        $orderby = 'name';
+                        $show_count = 0; // 1 for yes, 0 for no
+                        $pad_counts = 0; // 1 for yes, 0 for no
+                        $hierarchical = 1; // 1 for yes, 0 for no
+                        $taxonomy = 'genre';
+                        $title = '';
+
+                        $args = array(
+                          'orderby' => $orderby,
+                          'show_count' => $show_count,
+                          'pad_counts' => $pad_counts,
+                          'hierarchical' => $hierarchical,
+                          'taxonomy' => $taxonomy,
+                          'title_li' => $title
+                        );
+                        ?>
+                        <ul>
+                        <?php
+                        wp_list_categories($args);
+                        ?>
+                        </ul>
+                    <?php } else { ?>
+                        <?php if(have_posts()) : while(have_posts()): the_post();?>
+                        <?php the_content();?>
+                        <?php endwhile; else:?>
+                        <p><?php _e('Sorry, no posts yet');?></p>
+                        <?php endif;?>
+                    <?php } ?>
             </div>
         </div>
     </div>