Number format for wp_count_posts()

You can use the PHP function number_format(). function wpb_total_posts() { $total = wp_count_posts()->publish; echo number_format( $total, // your number 0, // number of decimal points ‘.’, // decimal point separator ‘,’ // thousands separator ); } Or, because you are using the default values anyway, you can shorten the function to: function wpb_total_posts() { echo … Read more

Is there a way to apply WordPress categories at the block level?

No, on a logical level applying categories to blocks is equivalent to applying categories to paragraphs and shortcodes. They can’t be coaxed into it either via a custom object taxonomy as blocks don’t have numeric unique IDs I’m not sure what problem you’re trying to solve, but this is not the solution.

Filter Custom Post Type by Category with Ajax

Nevermind, I’ve managed to solve it. For anyone interested, the problem was ‘category__in’ isn’t support by custom post types so instead needed to edit the $args array to include ‘tax_query’. $args = array( ‘post_type’ => ‘libraries’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘library_types’, ‘terms’ => $category ), ), );

count the total number of comments the user has received for his published posts

You can use the get_comments() function like so: $total = get_comments( array( ‘post_author’ => get_current_user_id(), ‘post_status’ => ‘publish’, ‘type’ => ‘comment’, ‘count’ => true, ) ); echo ‘total comments of your all posts : ‘ . $total; Just customize the arguments based on your requirements/preferences, and in the above example, I’m retrieving the total number … Read more

Getting category posts from a certain year

Is there a trick to get for wwx.example.com/year/category/ The main query is open to public query variables like year and cat so without pretty permalinks you could try www.example.com/?year=2022&cat=5 where 5 is the category id as an example and with pretty permalinks it would be redirected to www.example.com/2022/?cat=5

Get the most repeated post contents from a search?

The problem with your approach is that post’s content pretty much ignored in WordPress query architecture. It is meant to be textual information, as opposed to technical meta information. You have several options: Try to modify raw SQL of query request through filters, such as posts_where. Assign school name to custom field and use custom … Read more

Specifying # of Posts per page using inline post plugin (:

According to the plugin’s description in order to embed a post, you need to enter the post ID in the square brackets. For example [42] will embed the post with ID 42. So I assume to include multiple posts you have to include multiple IDs using the same short code. Example [22][37][42] P.S – Didnt … Read more