Taxonomies not appearing in columns on dashboard

Call register_taxonomy() with ‘show_admin_column’ => TRUE and WordPress will create your columns automatically. This parameter was added in version 3.5. You don’t need a custom filter anymore. I have written a small plugin to demonstrate this case: t5-taxonomy-location. This is the registration code: protected function register_taxonomy() { $this->set_labels(); $args = array ( ‘labels’ => $this->labels, … Read more

How to add HTML5 ‘required’ attribute to wp_dropdown_categories() without JavaScripts?

If you want to apply the required attribute every time you use wp_categories_dropdown, use wp_dropdown_cats filter as suggested in other answers: add_filter( ‘wp_dropdown_cats’, ‘wp_dropdown_categories_required’ ); function wp_dropdown_categories_required( $output ){ return preg_replace( ‘^’ . preg_quote( ‘<select ‘ ) . ‘^’, ‘<select required ‘, $output ); } If you want to apply the required attribute only in … Read more

Using Taxonomy Image code with my get_categories code

No luck by using plugin provided functions as it gets it’s id by $obj = get_queried_object(); To get the image I use this code snippet: $associations = taxonomy_image_plugin_get_associations(); $tt_id = absint( $taxonomy_term->term_id ); if ( array_key_exists( $tt_id, $associations ) ) { $image_id = absint( $associations[ $tt_id ] ); } $image = wp_get_attachment_image( $image_id, ‘thumbnail’ );

Display Post by taxonomy and taxonomy child if exist

I would use in this case two custom taxonomies: hotel-country stars both none-hierarchical then your query would be as simple as for example hotel in uk with 2 stars: $args = array( ‘post_type’ => ‘hotel’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘hotel-country’, ‘field’ => ‘slug’, ‘terms’ => array( ‘uk’ ), ), array( … Read more

Include custom post type in “all posts”

Filter pre_get_posts: add_filter( ‘pre_get_posts’, ‘wpse_98213_add_post_types_to_tax_query’ ); /** * Let WP search for custom post types on taxonomy archives. * * @wp-hook pre_get_posts * @param object $query * @return object */ function wpse_98213_add_post_types_to_tax_query( $query ) { if ( ! is_main_query() or ! is_tax( ‘your_taxonomy_name’ ) ) return $query; $query->set( ‘post_type’, array ( ‘portfolio’, ‘post’ ) ); … Read more

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