Support » Plugins » Targeting categories in custom fields

  • Hi

    I was hoping somebody could help me out with custom fields.

    I created a custom post type called game-type in WordPress. In this I have the categories “Android”, “iOS” and “PC”, then within these I have categories for types of games “3D Action”, “Classics”, “Platform” etc.

    So an example hierarchy for each post works like this:
    Games > Android > 3D Action > Post (Game)

    So far I’ve managed to call a list of categories using the code:

    	//list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)
    	$taxonomy     = 'game-type';
    	$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
    	$title        = '';
    	$args = array(
     	 'taxonomy'     => $taxonomy,
     	 'orderby'      => $orderby,
     	 'show_count'   => $show_count,
     	 'pad_counts'   => $pad_counts,
     	 'hierarchical' => $hierarchical,
     	 'title_li'     => $title
    	<?php wp_list_categories( $args ); ?>

    But this lists all the categories in my custom field. Is there a way to target just the categories in “android”?

    Your help would be much appreciated.



  • The topic ‘Targeting categories in custom fields’ is closed to new replies.