Description of a sub-taxonomy

Term description works only with term id and the taxonomy name, so if you want to get the sub term’s description, you should first get all the children of a term(and their children, if its another level deep) and loop over their ids with a single term_description call per id. <?php $my_taxonomy = ‘institute’; $terms … Read more

Alternative for is_taxonomy() to workaround theme’s default sidebar

The function that replaces is_taxonomy() is named taxonomy_exists(). Than there’s also is_tax() and is_tag() that check if the query is for a taxonomy archive page. EDIT $selected_sidebar_replacement == ‘0’ || $selected_sidebar_replacement == ” won’t work. You’re not checking the type. Better do it like this: if ( ! $selected_sidebar_replacement OR emtpy( $selected_sidebar_replacement ) )

retrieve post slug by post_tags taxonomy

i am not sure but try this: query_posts(‘category_name=”. $category[0]->cat_name); if (have_posts()) : while (have_posts()) : the_post(); $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { $all_tags_arr[] = array($tag->name,wp_basename(get_permalink())); } } endwhile; endif; foreach ($all_tags_arr as $cat_by_tag) { $output_promotion .= “<li><a href=”‘ . get_bloginfo(‘url’). “https://wordpress.stackexchange.com/” . $cat_by_tag[1] . “https://wordpress.stackexchange.com/”>’. $cat_by_tag[0] .'</a></li>’; } print_r($output_promotion);

Implode Taxonomy to hide parents?

You can check if the resulting term has any children before adding it to the array: $terms = get_the_terms($wp_query->post->ID, ‘propertytype’); $props = array(); foreach ($terms as $term) { $hasChildrenTest = get_term_children($term->ID, ‘propertyType’); if ($term->parent) { if (empty($hasChildrenTest) && !is_wp_error($hasChildrenTest)) { $props[] = $term->name; } } echo implode(‘, ‘, $props); ps: the if($term->parent) test might become … Read more

Why does my taxonomy code display the first alphabetical term?

With wp_get_object_terms() you’re able to manipulate the sorting. Make sure you tweak the sorting to what you want. Try something more or less like this (Updated: 5/17/2012 — 8:15AM): $taxonomyName=”producttype”; $terms = wp_get_object_terms($wp_query->post->ID, $taxonomyName, array(‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘fields’ => ‘all’)); if(!empty($terms)){ if(!is_wp_error($terms)){ for($i = 0; $i < count($terms); $i++){ if($terms[$i]->parent != 0){ … Read more

Passing values by form to create a query

It all depends on how you’re trying to do it. When it comes to filtering results, i usually setup the form to use $_GET and filter the results when the page loads again: if (isset($_GET[‘term’])) { $term = $_GET[‘term’]; } else { $term = ‘defaultTerm’; } if (isset($_GET[‘childterm’])) { $childterm = $_GET[‘childterm’]; } else { … Read more

list taxonomy based on taxonomy

If you are trying to print children of a category, this should be sufficient: <?php wp_list_categories(‘orderby=id&show_count=1&use_desc_for_title=0&child_of=”.$term_id); ?> Details here: http://codex.wordpress.org/Template_Tags/wp_list_categories

Show min and max taxonomy values

Not sure but try this: function get_years ($taxonomies, $args){ $output = array(); $hlterms = get_terms($taxonomies, $args); foreach($hlterms as $term){ $term_taxonomy = $term->year; array_push($output, $term->name); } return $output; } $taxonomies = array (‘year’); $args = array (‘hide_empty’=>true); $year = get_years($taxonomies, $args); echo min($year);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)