WordPress.org

Ready to get started?Download WordPress

Forums

Query Multiple Taxonomies
Hierarchical Taxonomies: Query ONLY parents and/or query ONLY children? (1 post)

  1. avariel
    Member
    Posted 1 year ago #

    Hello!

    First of all, Scribu -- I really have to say thank you so much for creating this amazing plugin. The code is very well-written and it accomplishes something that I've been trying to figure out how to do for a very long time.

    That being said, there is ONE thing that I need it to do. I'm okay with PHP, and I think this is just a tad over my head. So if someone could help me out with this, even just nudge me in the right direction -- that would be fantastic.

    Here is a link to the site I'm working on: http://tunagaming.dyndns.org/?section=tutorials

    When you select a platform, the taxonomy 'platforms' is replaced by the taxonomy 'genre.' And when you select a genre, the taxonomy 'genre' is replaced by the taxonomy 'subgenre.'

    But this is what I want to achieve. Rather than having Platforms, Genre, and Sub-Genre, I'd like to have just Platforms and Genre.

    Genre would be a hierarchical taxonomy, and would display only PARENT terms once the user has selected a platform. Then, once a genre is selected, I would like for it to display children of the selected parent.

    Again, I'm not looking for someone to code this for me, but if anyone could help lead me in the right direction that would be fantastic.

    All of this is in archive.php, here's the current code if you need it (perhaps it will explain my intentions further):

    <?php if (is_multitax( array('section', 'platforms', 'genre') ) ){
    
    the_widget('Taxonomy_Drill_Down_Widget', array(
    	'title' => '',
    	'mode' => 'lists',
    	'taxonomies' => array('subgenre')
    ));?>
    	<div id="postList">
    	<h2>Query Results</h2>
    	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    	<ul><a title="<?php the_title();?>" href="<?php the_permalink();?>"><li>
    		<span class="image"><?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?></span>
    		<span class="content">
    		<h3><?php the_title();?></h3>
    		<?php the_excerpt(); ?>
    		</span>
    
    	</ul></li></a>
    	<?php endwhile; ?>
    	</div>
    
    <?php
    }
    elseif (is_multitax( array('section', 'platforms') ) ) {
    
    the_widget('Taxonomy_Drill_Down_Widget', array(
    	'title' => '',
    	'mode' => 'lists',
    	'taxonomies' => array('genre')
    ));
    ?>
    
    	<div id="postList">
    	<h2>Query Results</h2>
    	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    	<ul><a title="<?php the_title();?>" href="<?php the_permalink();?>"><li>
    		<span class="image"><?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?></span>
    		<span class="content">
    		<h3><?php the_title();?></h3>
    		<?php the_excerpt(); ?>
    		</span>
    
    	</ul></li></a>
    	<?php endwhile; ?>
    	</div>
    <?php
    }
    else {
    the_widget('Taxonomy_Drill_Down_Widget', array(
    	'title' => '',
    	'mode' => 'lists',
    	'taxonomies' => array('platforms') // list of taxonomy names
    ));
    ?>
    
    	<div id="postList">
    	<h2>Latest Entries</h2>
    	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    	<ul><a title="<?php the_title();?>" href="<?php the_permalink();?>"><li>
    		<span class="image"><?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?></span>
    		<span class="content">
    		<h3><?php the_title();?></h3>
    		<?php the_excerpt(); ?>
    		</span>
    
    	</ul></li></a>
    	<?php endwhile; ?>
    	</div>
    <?php } ?>

    http://wordpress.org/extend/plugins/query-multiple-taxonomies/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic