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>’; }

pre_get_posts Tax Query not working for custom author page

Don’t run a new query in the template, modify the main query before it’s run via the pre_get_posts action in the theme’s functions.php file. function wpd_author_query( $query ) { if ( $query->is_author() && $query->is_main_query() ) { // your code to set $current_user_name here $query->set( ‘meta_key’, ‘_writer_relation_added_date_’ . $current_user_name ); $query->set( ‘orderby’, ‘meta_value_num’ ); $tax_query = … Read more

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