Custom Taxonomy
-
I have created custom taxonomies and now I would like to add a conditional to the archive page to deal with them differently.
I see that is_taxonomy has been deprecated, but I don’t know how I would use the replacement?
I have a bunch of genres for my event listings using a custom post type and custom taxonomies, so I when I click on ‘HipHop’ I get a list of event posts with that genre..simple stuff of course, exactly like categories.
Now if I use this:
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> <?php /* If this is a category archive */ if (is_category()) { ?> <h2>Archive for the ‘<?php single_cat_title(); ?>’ Category</h2> <?php /* If this is a category archive */ if (is_taxonomy()) { ?> <h2>Archive for the ‘<?php single_cat_title(); ?>’ Category</h2> <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?> <h2>Posts Tagged ‘<?php single_tag_title(); ?>’</h2> <?php /* If this is a daily archive */ } elseif (is_day()) { ?> <h2>Archive for <?php the_time('F jS, Y'); ?></h2> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> <h2>Archive for <?php the_time('F, Y'); ?></h2> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <h2>Archive for <?php the_time('Y'); ?></h2> <?php /* If this is an author archive */ } elseif (is_author()) { ?> <h2>Author Archive</h2> <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> <h2>Blog Archives</h2> <?php } ?>On my archive page and click on ‘hiphop’ from the dashboard I get an error, of course. I don;t know how I could use the taxonomy_exists() function in its place?
Also, is it possible to order posts by meta data? I have a date being input as a custom field and I would like to order by that , rather than the publiched date. It is currently a string but I can hopefully work around that.
Thankyou
The topic ‘Custom Taxonomy’ is closed to new replies.