Questions tagged [count]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
3answers
1k views

Counting number of identical meta keys

Im looking to count how many meta keys exist within a post, because each time a specific user action happens, a new meta key is created with a date in it. I have this, which does not return anything (...
0
votes
2answers
17 views

Show the amount of posts in a tag in a specific category has

I am creating a page template in Wordpress that displays multiple tags that are in a particular category. I have this working, but now I want to have the number of posts within each tag that is ...
0
votes
0answers
29 views

How can I show how much water got saved on this order (making use of the number of items bought) on a thank-you-page?

More detailed: I'd like to use the the number of items which were bought by somebody and multiplicate it with a number, to show how much water somebody saved. function random_message(){ $...
0
votes
2answers
31 views

check the first login for specific roles

Based on this answer i created a small functionality for users that are logging in for the first 3 times to make some elements classes use css animation. What i am trying to do is to adjust this code ...
0
votes
0answers
20 views

Display total of posts even deleted ones

I am creating a blog now and it is still brand new. I'd like to set a counter that counts the total of the posts that will be posted on the blog. I will be deleting posts regularly but I don't want ...
8
votes
7answers
50k views

Count posts within a custom post type and specific category

I'm looking to count how many post live within the custom post type called "videos", but only the ones from the category called "work". <?php $count_posts = wp_count_posts('videos'); echo $...
0
votes
1answer
18 views

php loop error for count posts in category

I have multiple categories on my wordpress page and each of the categories has 1 to n subcategories. If a subcategory contains only 1 single post I would love to display an excerpt of this post, ...
2
votes
1answer
526 views

Double count view in archive.php

I'm having a hard time using this snippet I'm getting double views each time the post is queried. This is in my functions.php file: function getPostViews($postID){ $count_key = 'post_views_count';...
0
votes
2answers
587 views

How to exclude posts from category posts count

I have a custom loop to display posts based on a custom field. My problem is that if i have 2 posts and exclude 1 from the loop the category posts count (categories list widget with show count enable) ...
0
votes
0answers
10 views

count list in Costume Field that created by profile builder

I have created a Costume Field called " Field of expertise " under this there are 12 Selection i want to count those selection automatically even if i add more or delete in the control panel ...
0
votes
2answers
46 views

How to display total user count by specific role in WordPress as statistics?

i want to display in my Home page total user count by specific role in WordPress as statistics I already created Role (subscriber, contributor) and i want to show the total users for each of those ...
1
vote
2answers
1k views

custom post type category count shortcode

I'd like to create a shortcode that would display the post count for a specific category within a custom post type. I've been trying to alter the code below but need some help. Could anyone let me ...
0
votes
1answer
32 views

How do I find the count of the current post?

Let's say my custom post type is 'story'. I've got 20 stories published on my site. So each post becomes: 'story 1', 'story 2', ... 'story 20'. Thus, first post is 'story 1', and last post is 'story ...
1
vote
2answers
2k views

Count all comments of a custom post type

I know how to count comment per post, user and in total but i am having problems getting the total amount of comments post in a specific post type. I guess i can loop trough all the posts and count ...
0
votes
2answers
773 views

divide custom field values in div every two values

i have this html mark-up to sort some data <div class="row"> <div class="col-xs-2"> <img src="images/member-schools/ms1.jpg" class="img-responsive"> </div> <div class="...
0
votes
2answers
43 views

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 ...
0
votes
1answer
43 views

Count several post tags

This maybe should be posted on a php forum, but since it's WordPress related, I'm giving it a try here.. With this code, I'll get the total count of posts work a certain tag; $term = get_term_by('...
2
votes
4answers
7k views

How to count get_users query?

I have been searching high and low for a way to count the amount of results from a get_users query. Most of what I found is to count the total number of posts in a post query, but nothing for ...
0
votes
1answer
2k views

Show posts count for Categories and Tags in wp_nav_menu

I'm trying to show WooCommerce Product Categories, Post Categories, Product Tags, Post Tags and Custom Taxonomy posts count in main navigation using wp_nav_menu. My WP_NAV_MENU code &...
0
votes
2answers
30 views

order posts by a secondary query that counts items

i'm working on a music plugin. It uses a custom table tracklist_items to store every tracks of a playlist; which has a structure like this : |id| |track_id| |tracklist_id| |order| |time| So if I ...
0
votes
0answers
18 views

How to get the total number of posts (in PHP) and pass it to Javascript?

I have an AJAX call that pulls the next page of posts on my home.php template. Now I want the total number of posts as a variable in the javascript file, so that I can use it in an if-statement to ...
0
votes
0answers
15 views

Shortcode to show the number of custom post type taxonomy

I would like to create a shortcode to show the number of taxonomies of a certain custom post type: I would like to show with the shortcode the number of "coupon_stores" and if is possible another ...
2
votes
6answers
8k views

Get count of custom post type created by current user

I'm trying to get the count of published posts in a custom post type for the current user (to display on a profile page). I found this here on the forums: <?php global $wp_query; $curauth = $...
3
votes
2answers
11k views

Count post that have specific meta value

How do I count only the post that have a specific custom meta field value? $productCount = wp_count_posts('product'); echo $productCount->publish; That gives me all the total of all the post. ...
0
votes
4answers
2k views

Counting posts in custom post type by author

I have googled this a few different ways, but cannot find the answer I'm looking for. I want to be able to count the number of posts each author has within a custom post type. Any suggestions would be ...
2
votes
0answers
47 views

How to trace/fix false $term->count, rogue term relationships?

On a page listing terms from my 'source' taxonomy, I loop through foreach term... foreach ($all_source_terms as $source_term) { // some stuff echo $source_term->count; } When I echo $...
4
votes
2answers
2k views

Comment Count for each Comment Author

In WordPress 3.4.1: I am trying to add the Comment Author's total number of comments beside their info. (name + date/time) in the comment's list. Here is the SQL that I am using: $count = $wpdb->...
0
votes
0answers
322 views

Pagination is not working properly in Product Category/Tag pages

I have a store with several products. Pagination works fine on the main shop page. But when I open a separate product category or product tag pages, in some of them pagination not working as expected....
0
votes
0answers
16 views

Can I reset post counters for categories?

I've noticed my post counters in Dashboard - Posts - Categories are showing wrong values. For example, it shows a positive numbers in the Count column for categories, that have zero posts associated ...
0
votes
1answer
26 views

Author comment count in author page

hi i want to show author comment count in author page. this code can display current user comment count but i dont want current user i need any user please help me /* user commnet count */ ...
0
votes
2answers
28 views

In WordPress, how do I get the number of posts next to single_cat_title(''); in the category.php file?

In WordPress, how do I get the number of posts next to <?php single_cat_title(''); ?> in the category.php file? <h1><?php single_cat_title(''); ?> (<?php ????code to count number ...
0
votes
0answers
26 views

Fetch likes count

I’m using Buddypress with rtmedia plugin. What I'm trying to achieve is to display total media likes count of each members' gallery on their respective header. I tried this code but it always displays ...
1
vote
1answer
248 views

Adding country tags automatically

I want to show country flags on post cards.My plan is showing flag icons with below code: <img src="/icons/<?php echo $tagName; ?>.png" /> However I dont know how can I add country tags ...
0
votes
0answers
25 views

count total number of post using a particular image

i would like to know how many posts are using a particular image. But the only way i found is checking every post_content in the wp_posts table and looking if the image is used in there. is there a ...
1
vote
1answer
2k views

Warning: sizeof (): Parameter must be an array or an object that implements Countable, On products pages

I have a WooCommerce WordPress Theme installed. I'm getting an error that public users can see, So I need to fix it ASAP. The error is shown on all products pages, Here is the error: Warning: ...
0
votes
1answer
428 views

User count only for role frontend vendor

i use the following code for count the authors $count_posts = wp_count_posts( 'download' ); echo 'Published eBook (' . $count_posts->publish . ')'; echo ' '; global $wpdb; $...
0
votes
0answers
47 views

get_queried_object not work in taxonomy page

I am trying to display post count by month of current custom taxonomy in custom taxonomy page. but it display total count by month <?php $post_type = "tesekkur"; $posts = get_queried_object()->...
0
votes
1answer
414 views

Taxonomy list. Order by a specific custom post type count

I have a custom taxonomy and two custom post types (A and B post types). I created a taxonomy list and this list also display B posts type count of taxonomy. Taxonomy list is ordered by post count. ...
0
votes
1answer
35 views

I am trying to get cutom post cout by month of current taxonmy term

Hi please help me how can i display custom post count by month like this at current taxonomy page. **i have been trying to solve this problem aready 2 weeks. ** December 0 January 0 February 0 ...
1
vote
0answers
165 views

Display post count by month of current taxonomy in archive page

Can anyone help me please. i want to show custom post type count by month of taxonomy in archive page for current year. Example: January 24 February 43 March 5 April 6 and etc. This code is help ful ...
1
vote
0answers
17 views

Post count by month of taxonmy term

Can anyone help me please. i want to show custom post type count by month of taxonomy in archive page for current year. Example: January 24 February 43 March 5 April 6 and etc
1
vote
0answers
14 views

There any way to get de percentage of number of post by user and category?

This is the thing, Id like to get the % of number of posts from a specific user and category, additionally choosing from 'n' last days, or get for 'n' posts. Example: A: User 2 have a 10% of total ...
2
votes
0answers
47 views

get_queried_object error How to show post count by month in the taxonomy page

Can anyone help me please. i want to show custom post type count by month of taxonomy in archive page for current year. Example: January 24 February 43 March 5 April 6 and etc. This code is help ful ...
0
votes
0answers
229 views

Get user count based on multiple meta key values?

I am trying to count all of the users meeting multiple criteria. I have tried so many different things and cannot get it to work. Any help is much appreciated. Thank you. add_shortcode('...
0
votes
1answer
132 views

How to count items of meta query?

I have manually edited a WordPress WooCommerce hook which hides all out of stock products. The problem is I don't know how to count items found. I tried $query->count but no result. My code: ...
0
votes
1answer
34 views

Count time from registration date to today

I would like to add to the user profile the time from registration to the current day in the format: With us: 7 years 3 months 2 weeks 6 days OR With us: 1 year 1 month 1 week 1 day Me a bit ...
0
votes
1answer
3k views

Post Views / Hit Counter Problem?

I have decide to use WordPress as a CMS to my 5 moths old website. I have already added all previous posts to my new site ( WordPress ). But now I need to change view counts to previous views counts. ...
2
votes
1answer
17k views

Count number of post in Taxonomy?

wp_count_terms() counts the number of terms in a taxonomy but not the number of post that have those terms and I've found that wp_count_post() does not accept a taxonomy. So whats a guy gotta do to ...
0
votes
2answers
2k views

Howto show comment count by post in post?

I would like to show comment count IN the post (not in post meta), is there a snippet how to do this or a wordpress internal shortcode?
0
votes
1answer
1k views

How to update incorrect post count in taxonomy?

I have imported a large amount of content using WPAllImport, all to a custom post type called "article" ("Articles") and all organised by a custom taxonomy type called "source" ("Sources"). However, ...

1
2 3 4 5 6