Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter adwrt

    (@adwrt)

    Also, is it actually possible to combine the “parent” and “current” parameters in a [for each]?

    Thread Starter adwrt

    (@adwrt)

    I figured out some modifications to foreach.php that would get me what I was looking fork. I hope you’ll incorporate it into your next version – or find an even better way to accomplish this!

    To use the parent and current arguments together, at the end of the if $current==”true” block, I added a modified version of what you had in the else block, which already tested for the $parent argument:

    if (!empty($parent)) {
    	/* Get parent term ID from slug */
    	if ( is_numeric($parent) ) {
    		$parent_term_id = $parent;
    	} else {
    		$term = get_term_by( 'slug', $parent, $each );
    		if (!empty($term))
    			$parent_term_id = $term->term_id;
    		else $parent_term_id = null;
    	}
    
    	if (!empty($parent_term_id)) {
    		/* Filter out terms that do not have the specified parent */
    		foreach($taxonomies as $key => $term) {
    			if ($term->parent != $parent_term_id) {
    				unset($taxonomies[$key]);
    			}
    		}
    
    	}
    }

    And, I added:

    self::$state['each']['description']=$term_object->description;

    and

    elseif (isset( $atts['description'] ))
    	$out = self::$state['each']['description'];

    towards the end to be able to use [each description] within the loop.

    Plugin Author Eliot Akira

    (@miyarakira)

    Hello, thank you again for another suggestion. I appreciate the code snippets, it saved me time to implement it. 🙂

    Thread Starter adwrt

    (@adwrt)

    My pleasure. Thanks so much for a great plugin!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘description field’ is closed to new replies.