Show post count in custom taxonomy page
İ found a solution: $posts = get_queried_object(); echo $posts->count;
İ found a solution: $posts = get_queried_object(); echo $posts->count;
Sorting Tag Cloud by Popularity
Try replacing this in the original code: $page = $wpdb->get_row($req); with this: $page = $wpdb->get_row($req, ARRAY_A); This will make it return an array instead of an object. Then you can follow with this: if ($page && isset($page[‘ID’])) { $category->id = $page[‘ID’]; } else {$category->id = 0;}
How to show custom post count in archive page
Count tags for current post and save into custom meta field (and update it on post edit)
function wpse340250_term_count( WP_Term $term, $post_type) { $q_args = [ ‘post_type’ => $post_type, ‘nopaging’ => true, // no limit, pagination ‘fields’ => ‘ids’, // only return post id’s instead of full WP_Post objects will speed up ‘tax_query’ => array( array( ‘taxonomy’ => $term->taxonomy, ‘field’ => ‘term_id’, ‘terms’ => $term->term_id, ), ), ]; $term_count = get_posts($q_args); return … Read more
Just gave an example of how to do it: $today_date = new DateTime( date( ‘Y-m-d’, strtotime( ‘today’ ) ) ); $register_date = get_the_author_meta( ‘user_registered’, get_current_user_id() ); $registered = new DateTime( date( ‘Y-m-d’, strtotime( $register_date ) ) ); $interval_date = $today_date->diff( $registered ); if( $interval_date->days < 31 ) { echo ‘With us ‘ . $interval_date->format(‘%d days’); … Read more
$query->found_posts may be what you are looking for from the code reference: https://developer.wordpress.org/reference/classes/wp_query/ Note that meta_query expects nested arrays, even if you only have one query. You may need to use: $meta_query[0][] = array( ….. You should also take care with the form of the original query. If there are one or more relations defined, … Read more
Get user count based on multiple meta key values?
get_queried_object not work in taxonomy page