Questions tagged [count]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
19 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 ...
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
1answer
43 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
23 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
827 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
2answers
536 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
1answer
421 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; $...
2
votes
1answer
470 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
0answers
33 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()->...
2
votes
2answers
9k 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
1answer
171 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
29 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
38 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
16 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
10 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
40 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 ...
1
vote
2answers
874 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
2answers
667 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
0answers
22 views

I want to get latest one post of a particular category

I want to get the latest one post on counting View Count. Latest I have tried this but didn't get the result : $popularpost = new WP_Query( array( 'post_type' => 'post', 'posts_per_page'...
0
votes
0answers
70 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
43 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
15 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
2k 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
15k 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
1k 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
713 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
votes
2answers
27 views

how to show Author post type count

I have multi author wordpress site and every author can publish posts from two different post types . i want to display author post count by post type in author.php . According to codex.wordpress i ...
0
votes
1answer
53 views

Get queried object for custom post type count

$posts = get_queried_object(); echo $posts->count; I can get post count with this code in taxonomy archive page . problem is that i can not specify post type. i just want count only A custom post ...
0
votes
2answers
37 views

Loop is crazy - one row displays wrong count of posts [closed]

Im having a loop with count to add a clear after 4 items. It is working pretty well but theres one rebell row that will only take 1 post. Code: <section class="bonds-funding"> ...
0
votes
0answers
31 views

Count tags for current post and save into custom meta field (and update it on post edit)

This question is sort of a follow up from another question on here Order posts by tags count? The first comment recommends counting the number of tags and saving it into a custom meta field. Going ...
0
votes
1answer
1k views

Shortcode with product catgory counter

I would like to create a custom shortcode that count individually product-categories in Woocomerce but I haven't found any code on net. I need somethink like: [counter product-category="example"] ...
0
votes
0answers
38 views

How to show custom post count in archive page

I want to show custom post count of taxonomies in archive page..not all custom post counts of taxonomy, i just want to show videos custom post count. because taxonomies have two custom post type. ...
2
votes
1answer
99 views

taxonomy list display custom post count

I use $term->count to display post count but it displays the total count of all type of custom posts attached to taxonomy... I just want to display the count of only a specific custom post type ...
0
votes
1answer
49 views

Count custom post types with a specific meta value

We have a custom type called books. In a template, we need to show the counts of books that have the book_type as Fiction Non Fiction Novel Short Stories We use ACF Pro, and the above field is set ...
0
votes
2answers
41 views

Warning: count(): syntax problem of the count () function

I'm trying to repair a function that was working properly before going to php 7.2. The error comes from the count () function but I do not know how to rewrite it. Can you help me ? Here is the error ...
0
votes
0answers
61 views

Sorting Tag Cloud by Popularity

So I have the default Wordpress Tag Cloud Widget on my sidebar/footer and I found the following code to limit the number that it's showing because it took up a ton of space. This code however is not ...
0
votes
1answer
53 views

line order number start numbering from second line (SOLVED)

if(is_tax()) { $currentTermType = get_query_var( 'taxonomy' ); $cat_icon = get_field('logo', $queried_object); ...
0
votes
3answers
55 views

Multisite - maximum number of users with specific role

Is there any plugin or script where i can use to define maximum number of users with a specific role on subsite in a multisite network? I'm offering cloud helpdesk wordpress and pricing is based on ...
0
votes
0answers
15 views

show count and sort by curtain post type in taxonomy list

i have a taxonomy list with post count and it sorted by post count. but i want taxonomy list to show only curtain post type count and sort by ount of this post type this is my code function ...
0
votes
1answer
33 views

Show post count in custom taxonomy page

How can I show the post count in a taxonomy page. I tried some codes but I could not get success. I will locate this information on the top of taxonomy page. foreach ( get_the_terms( get_the_ID(), '...
0
votes
1answer
17 views

Reverse count page view and show on other page

is there any php function for the child theme or plugin that makes the following possible in wordpress: Page A shows number 16 Website visitor visits page B Page A shows number 15 I would like to ...
0
votes
2answers
47 views

Get post number both in the loop and in the post

I have a post type that is essentially a photography zine. I want each post to display in the archive page as an "issue" with a number associated, from oldest to newest. The first issue would be "...
0
votes
1answer
55 views

Display post count on archive page in reverse order

I'm displaying some posts and I want each of them to display a post number. The first post being number 1, the most recent post being 10 (let's say there's 10 posts.) I'm currently using <?php ...
0
votes
1answer
377 views

How to add a post counter to the list of custom taxonomy terms?

I am using the below code to display the list (radio buttons) of terms that are currently used by existing custom post type posts: $args = array( 'taxonomy' => 'typ', 'post_type' => '...
7
votes
6answers
46k 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
427 views

How can I count ACF sub_field with a certain value

I have a sub field that have several different values. What I'm trying to do is count the number of rows if they're equal to Mayor. So my code looks like this: if( have_rows('candidates') ): ...
0
votes
1answer
42 views

How to count posts in tags within time limit

When we list tags we can get the count and even sort by count like this: $tags = get_tags([ 'orderby' => 'count', 'order' => 'DESC', 'include' => $term_ids, ]); But how can we ...
0
votes
1answer
176 views

How do I insert a <div> after every 5 posts in a WordPress Loop that infinitely loads posts?

So I have a WPQuery loop set up that works great and uses and infinite scroll to keep loading posts in batches of 10 posts. What I would like to do is insert a <div> after every 5th post in the ...
0
votes
2answers
41 views

Search Count Wordpress Theme

I have a code that displays results for search but, I need it to include the count not just keyword searched <h1 class="font-thin h2 m-b"> <?php printf( esc_html__( 'Search Results for: %s',...
0
votes
0answers
23 views

Count posts associated with another post type

I have two custom post types in Wordpress: Events and Venues. I need to count the number of Events associated with the individual venues and have the counts displayed in a column on the Venues page in ...

1 2 3 4 5 6