Count how many posts have a specified tag AND category

I know how to count how many posts has a certain tag, or category

For example:

$  term_slug = 'some-post-tag'; $  term = get_term_by('slug', $  term_slug, $  post_tag); echo $  term->count; 

BUT! Is there anyway to count how many posts that have a tag AND a specified category?

I want to count how many posts that have the tag(slug) “cats” and the category slug “allow-list”

Is this even possible?

Send push when new post is published in a certain category

I’m trying to develop a plugin which send a push notification to an app users, when a new post is published on a certain category. I’m trying with the hook save_post, but when the hook is fired, the post has no categories. I try in_category(2) function, but it always return false. I try wp_get_post_categories($ post_id) but always resolve to no categories and the same with wp_get_post_terms($ post_id, 'category')

I dont know if save_post hook is the correct, I think it’s fired before the categories are asociated to the post.

How I know if the post is published in a certain category?

Does hurling a thrown weapon change the weapon’s category for determining proficiency?

On Weapon Categories says, “A melee weapon with the heavy thrown or the light thrown property counts as a ranged weapon when thrown” (Player’s Handbook 215). (Similar text is absent from the Rules Compendium, but I’m not familiar enough with 4e to know if this absence is an issue.)

With this in mind, if a character who has proficiency with military melee weapons but lacks proficiency with military ranged weapons throws a handaxe—a military weapon—, does the character still receive his proficiency bonus on the attack roll?

That is, when a military melee weapon is thrown does the military melee weapon remain a melee military weapon therefore the character above gains his proficiency bonus with it? Or does the thrown military melee weapon now count as a military ranged weapon therefore the character above does not gain his proficiency bonus with it? Or is this even more—or less!—complex than I’m imagining?


Note: My level 3 battlemind who has Strength 10, Dexterity 12, proficiency with simple and military ranged weapons, and proficiency only with simple ranged weapons will still normally make his ranged basic attacks with daggers—preferring accuracy to damage—, but I want to assess my future options just in case. Also, I know I’m late to the party, and I apologize if this is a topic that’s already been discussed to death elsewhere.

WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)

This is really confusing me.

I’ve tried numerous things but cannot get appropriate results.

Here’s what I currently have for my query:

$  args = array(     'post_type' => 'product',     'tax_query' => array(         'relation' => 'AND',         array(             'taxonomy' => 'product_cat',             'field'    => 'slug',             'terms'    => array( 'ring' ),         ),         array(             'taxonomy' => 'product_tag',             'field'    => 'slug',             'terms'    => array( 'black', 'men' ),         ),     ), ); $  query = new WP_Query( $  args ); 

As you can see I am trying to return products in the product category ring that contain both the tags black AND men

It appears though the product_tag terms array which includes black and men, is returning posts that include the tag black OR the tag men in the ring category.

How do I get it so that only products that include BOTH the tags in the query are returned?

Thanks so much

Remove pagination from e-commerce category page while preserving SEO text relevance

I am administering an e-commerce website where currently we have pagination implemented on every category page.

On the first page of each category, we have SEO text in the bottom – a description of the category which helps our page to rank higher in search results. In many cases, it is long enough to make it impractical to place it at the top of the page.

I am flirting with the idea of converting our structure to an “infinite scroll” experience, to remove pagination altogether. I realise that this would yield some SEO benefits.

However, I am seriously worried that a lengthy list of products would dilute the importance of our category description at the bottom. I remember reading somewhere that Google places more importance on the content which is higher on the page.

Has anyone tried to implement the “infinite scroll” and did you notice any serious changes in your ranking? Or maybe you have an idea as to how it will affect the relevance of the category description at the bottom of the page?

How to display singular form of category name?

I have the following code to show the names of the categories for a single post. My categories are named in the plural (i.e. articles, letters, translations, commentaries, etc.), but in this function I want to return a singular version of the name, i.e. article, letter, translation, commentary, etc.).

$  categories = get_the_terms( $  post->ID, 'category' ); if( !empty( $  categories ) && !is_wp_error( $  categories ) ) {         foreach( $  categories as $  category ) {         $  catdisplay = sprintf(             '<a target="_blank" href="%1$  s">%2$  s</a>%3$  s',             esc_url( get_term_link( $  category ) ),             esc_html( $  category->name ),             '<span class="cat-sep">, </span>'         );          echo sprintf( esc_html__( '%s', 'textdomain' ), $  catdisplay );     } } 

I was thinking to build in something with the following logic: if name = “articles” return “article”, or if name returned = “commentaries” return “commentary”, but am unsure how to accomplish that or if there’s a better way to do it. I’m also open to better ways to structure the above code.

“Portfolio” filter in Pure theme filtering more than one category at a time

I downloaded this theme which looks amazing. If you click on the filter it filters the posts by category. I installed it and I noticed this filter is called “portfolio”. I implemented it and looks amazing, I was wondering if there was a way to make it so that if I click on more than one filter it keeps the previous selection active, for example in the given link if I click on “Branding” and “Poligraphy” it keeps both the filters active and keeps all the posts with categories Branding OR Poligraphy. Right now it just switches betweens the two categories and just basically filters one at a time.

Thank you!