Multiple Custom Post Type with different Taxonomies

Try this: function post_type_categories() { $field_args = array( ‘labels’ => array( ‘name’ => ‘Categories’, ‘taxonomy general name’, ‘singular_name’ => ‘Category’, ‘taxonomy singular name’, ‘search_items’ => ‘Search categories’, ‘all_items’ => ‘All categories’, ‘parent_item’ => ‘Parent category’, ‘parent_item_colon’ => ‘Parent category:’, ‘edit_item’ => ‘Edit category’, ‘update_item’ => ‘Edit category’, ‘add_new_item’ => ‘Add new category’, ‘new_item_name’ => ‘New … Read more

How to add some filter to Category Taxonomy

Exclude child categories when getting posts from parent: use category__in Here using category id: $query = new WP_Query( array( ‘category__in’ => 4 ) ); Excluding children of custom taxonomies: tax_query argument of WP_Query has include_children set to true by default, so you can set that to false. include_children (boolean) – Whether or not to include … Read more

How to customize taxonomy edit page

Check that below code block, hope it will help you. Put it in your plugin or in theme’s functions.phpfile and it’ll work. I tested it with category taxonomy. The code block- // {$taxonomy}_edit_form_fields you should use add_action( ‘album_edit_form_fields’, ‘the_dramatist_add_custom_fields_to_taxonomy_edit_page’, 10, 2 ); /** * The function for rendering posts related to the term. * * … Read more

how do you get one specific term from a shortcode attribute?

It seems like you are trying to get a term by it’s slug or name. get_term() will get all the term’s data by it’s id. In this case, use get_term_by() instead: function product_category_button($atts) { extract(shortcode_atts(array( ‘category’ => ”, ), $atts)); // if( $category ) : // Vars $taxonomy = ‘product_categories’; // Use ‘name’ instead of … Read more

Changing an item in drop down after 5 latest posts per taxonomy

Have a closer look to the blow code- $query_args = array( ‘posts_per_page’ => ‘5’, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ); $listedPosts = new WP_Query($query_args); // the loop if ( $listedPosts->have_posts() ) { while ( $listedPosts->have_posts() ) { $listedPosts->the_post(); if ( (int) $listedPosts->current_post == 5 ) { // You need to use ‘==’ or ‘===’ … Read more

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