Filtering posts in category by tag URL
Filtering posts in category by tag URL
Filtering posts in category by tag URL
For specifically post categories, you can use get_the_categories filter hook to remove certain found category (term). function filter_get_the_category( $categories, $post_id ) { // loop post categories foreach ($categories as $index => $category) { // check for certain category, you could also check for $term->slug or $term->term_id if ( ‘Featured’ === $category->name ) { // remove … Read more
Display Category Name and Date Posted on Blog Post
For post types not using the block editor, you can use wp_terms_checklist_args filter to manipulate the selected terms of a hierarchical taxonomy. You can use the filter to set pre-selected terms like so, function auto_check_hierarchial_terms_on_new_post( $args, $post_id ) { // is it new post? if ( ‘auto-draft’ !== get_post_status($post_id) ) { return $args; } // … Read more
How to prevent tag “iframe” from being deleted from the heading description of rubric?
You would need to override the template in WooCommerce which displays the category page and add in your own sidebar / html. woocommerce/templates/archive-product.php You can read up on how to do this here: https://docs.woocommerce.com/document/template-structure/ Don’t forget to add theme support in your functions.php file too. function mytheme_add_woocommerce_support() { add_theme_support( ‘woocommerce’ ); } add_action( ‘after_setup_theme’, ‘mytheme_add_woocommerce_support’ … Read more
For menus this large, it’s usually more efficient to use functions like wp_list_categories() (which can also output custom taxonomies like Product Categories) in whatever theme template you need to affect. Bonus: your menu will always be current, because unlike a static WP Nav Menu, this will always pull all Product Categories and not need manual … Read more
Possible to make get_categories() hide_empty attribute honor excludes from post query?
You can use simply category__not_in parameter to exclude one or several categories from your result. The sample is like this: $query = new WP_Query( array( ‘category__not_in’ => array( 2, 6 ) ) ); To see list of available parameters and complete example, see documentation of WP_Query in developer.wordpress.org I hope you can use it.
The problem is here: switch_to_blog($subsite_id); $blog_posts = get_posts(); restore_current_blog(); foreach( $blog_posts as $post ) { setup_postdata( $post ); get_template_part( ‘theme-partials/post-templates/loop-content/masonry’ ); } Your code fetches a number of posts, but then you switch back to the original blog! So now post number 5 means something completely different than it did before. You need to stay … Read more