Change permalink of post if it belongs to custom taxonomy

You can modify the permalinks using the the_permalink filter and add a rewrite rule using add_rewrite_rule to redirect the new permalinks to the standard post link. function mysite_modify_permalink($url) { global $post; //if taxonomy archive for Series get term $term = is_tax(‘Series’)?get_query_var(‘term’):”; if(empty($term)) { //if no term was found //get all Series terms for current post … Read more

How to display featured images for all posts with certain taxonomy label?

Something quite rough that needs improvement but can give you a starting point, if I’ve understood your needs: use [dr] as shortcode marker where you want function my_dream_shortcode($atts, $content = null) { ob_start(); ?> <ul> <li class=”button” onClick=”get_data(‘corporate’)”>Corporate</li> <li class=”button” onClick=”get_data(‘sales’)”>Sales</li> <li class=”button” onClick=”get_data(‘support’)”>Support</li> </ul> <div class=”my_plugin_result”></div> <style> li.button{ list-style:none; padding:4px 10px; background-color:cadetblue; margin:10px; float:left; … Read more

Make tag cloud links consistent

How about passing the smallest and largest arguments to wp_tag_cloud() and making them both the same? <?php wp_tag_cloud( array( ‘taxonomy’ => ‘channels’, ‘smallest’ => ‘1’, ‘largest’ => ‘1’, ‘unit’ => ’em’, ) );?> Update: use get_terms() to get multiple taxonomy terms: <?php $terms = get_terms(array(‘channels’, ‘stations’)); if (is_array($terms)) : ?> <ol> <?php foreach ($terms as … Read more

Recreating the hierarchy of taxonomies for a dropdown form menu?

You can use the standard WordPress function, get the dropdown already formatted and solve both problems at once. Like so: define( ‘WP_USE_THEMES’, false ); require( ‘./wp-load.php’ ); wp_dropdown_categories( array( ‘child_of’ => 0, ‘class’ => ‘postform’, ‘depth’ => 0, ‘echo’ => 1, ‘exclude’ => ”, ‘hide_empty’ => false, ‘hide_if_empty’ => false, ‘hierarchical’ => true, ‘id’ => … Read more

Taxonomies in URL

I recently talked about this at a couple of WordCamps. Here’s my talk from WC Portland, and the slides, source code, etc. Check out Recipe #2 specifically. First off, you should probably have a static prefix to start the URLs. It’s not 100% necessary, but without it your rewrite will conflict with page permalinks. If … Read more

Display post taxonomies tree

What about: $taxName = “tvr_amenity”; $terms = get_terms($taxName,array(‘parent’ => 0)); foreach($terms as $term) { echo ‘<a href=”‘.get_term_link($term->slug,$taxName).'”>’.$term->name.'</a>’; $term_children = get_term_children($term->term_id,$taxName); echo ‘<ul>’; foreach($term_children as $term_child_id) { $term_child = get_term_by(‘id’,$term_child_id,$taxName); echo ‘<li><a href=”‘ . get_term_link( $term_child->name, $taxName ) . ‘”>’ . $term_child->name . ‘</a></li>’; } echo ‘</ul>’; }