How to set the same base url for two different taxonomies?
How to set the same base url for two different taxonomies?
How to set the same base url for two different taxonomies?
Sometimes you don’t realize that built-in features exist, even when you’re a veteran user. I had overlooked that categories have a sidebar choice feature. No wonder nobody answered.
Have you tried has_category? You can add a check to make sure the post has the specified category. If not then return the content un changed like below: <?php add_filter( ‘woocommerce_short_description’, ‘wpse_67108_autplay_music’ ); function wpse_67108_autplay_music( $content ) { if ( ! is_singular( ‘product’ ) && ! has_category( ‘<your specific category here>’ )) { return $content; … Read more
You’ll want to hook onto the wp_insert_post action. Once the new post is created, you can then assign it to the taxonomy/term you wish. It might look something like this: add_action(‘wp_insert_post’, function($postId, $post, $updatingExisting) { if( $updateExisting ) return; // read up on these params at http://developer.wordpress.org/reference/functions/wp_set_post_terms/ wp_set_post_terms( $postId, ‘main_podcast’, ‘qtserie’, true); }, 10, 3); … Read more
It may helpful to you… $video = (in_category ( 42 )) ? ‘has-video’ : ”; echo ‘<section id=”cooked-recipe-list-‘ . $list_id_counter . ‘” class=”cooked-clearfix cooked-recipe-‘ . $list_style . ‘ cooked-recipe-loader’ . ( in_array( $list_style, $masonry_layouts ) ? ‘ cooked-masonry’ : ” ) . ( isset($atts[‘columns’]) && $atts[‘columns’] ? ‘ cooked-columns-‘ . $atts[‘columns’] : ” ) . … Read more
An Example. A post for a game. People just comment the game. I wanna to have 3 types of comments. Comments form team A – comments for Team B and comments for the referee. This way all the comments are not mixed up. The hard way If I were to undertake such a project, my … Read more
global $wpdb; $post_ids = [1,2,3] //Array of all post ids // get all category id’s based on post ids $result = $wpdb->get_results( ” select term_taxonomy_id from ” . $wpdb->prefix . “term_relationships where object_id in (implode(“,”,$post_ids)) );
How to filter tags by category?
Meta Query | Compare category name and meta value
You can try something like: if ( is_category() ) { $cat = get_category( get_query_var( ‘cat’ ) ); // $cat_id = $cat->cat_ID; $cat_name = $cat->name; // $cat_slug = $cat->slug; $args = array( ‘category_name’ => $cat_name, ‘post_type’ => ‘post’, ‘orderby’ => ‘menu_order’, ‘order’ => ‘DESC’, ); … The function you are looking for is get_category, as well … Read more