spexer
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Hacks
In reply to: Show taxamony for a specific taxamonySorry misspelled taxonomy…
Forum: Plugins
In reply to: [One Page Portfolio] get_category_tags function clean upHello Guys, I hope its OK that I post my question here. I am trying to modify this script to show taxonomys inside another taxonomy.
This is what I got, any help would be great:
function get_tax_tags($args) { global $wpdb; $tp = $wpdb->prefix; $tags = $wpdb->get_results (" SELECT DISTINCT terms2.term_id as tag_id, terms2.name as tag_name, null as tag_link FROM wp_posts as p1 LEFT JOIN wp_term_relationships as r1 ON p1.ID = r1.object_ID LEFT JOIN wp_term_taxonomy as t1 ON r1.term_taxonomy_id = t1.term_taxonomy_id LEFT JOIN wp_terms as terms1 ON t1.term_id = terms1.term_id, wp_posts as p2 LEFT JOIN wp_term_relationships as r2 ON p2.ID = r2.object_ID LEFT JOIN wp_term_taxonomy as t2 ON r2.term_taxonomy_id = t2.term_taxonomy_id LEFT JOIN wp_terms as terms2 ON t2.term_id = terms2.term_id WHERE t1.taxonomy = 'rea' AND p1.post_status = 'publish' AND terms1.term_id IN (".$args['categories'].") AND t2.taxonomy = 'outlet' AND p2.post_status = 'publish' AND p1.ID = p2.ID ORDER by tag_name "); $count = 0; foreach ($tags as $tag) { $tags[$count]->tag_link = get_tag_link($tag->tag_id); $count++; } return $tags; }And my “show” function:
function yrken15() { if ( is_tax( 'rea' )) { global $wp_query; $tax = $wp_query->queried_object; print "\n" . '<ul class="featured-brands25" style="list-style: none;">'; echo '<h3>Du kan handla ' . strtolower(single_cat_title( '', false )) . ' från följande varumärken</h3>'; $the_id = $tax->term_id; echo $the_id; $tags = get_tax_tags($the_id); sort($tags); foreach ($tags as $tag) { print "\n" . '<li>'; print "\n\t" . '<p style="text-align: center;"><a class="classname2" href="' . get_home_url() . '/outlet/' . strtolower(str_replace(' ', '-', $tag->tag_name)) . '/">' . strtolower($tag->tag_name) . '</a></p>'; print "\n" . '</li>'; } print "\n" . '</ul>'; } else if ( is_tax( 'outlet' )) { } else { } }Getting the tax->term_id works fine (as the echoing line will tell) but no results shows up, any idea why? Also I found that when I am using the original setting with category and tags, the function works on some of my webhosts but not on other, why would that be?
Thank you guys in advance!
Regards Fredrik from Sweden
Hey! I am looking for the same thing. Did you ever find a way to do this?
Regards Fredrik
Viewing 3 replies - 1 through 3 (of 3 total)