Questions tagged [count]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
18 views

Counting instances of words in the results of a post query

I'm way over my head with this one and wonder if anyone can shine a light on where I'm going wrong. I am grabbing some authormeta for the resulting posts of a query, and I want to tally up the number ...
0
votes
0answers
26 views

Query posts by post type, author and post meta

Bit of an awkward one here, and there may not be a solutions within current WP core. Basically I have a CPT called "connection" with a custom meta field called "outcome" which ...
0
votes
0answers
12 views

display comment type count of post single page

I have comment type. when author marks any standart comment. standart comment convert to sticky comment type. but how can I display sticky comment type. This stikcy comment is used as accepted answer ...
2
votes
1answer
562 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
8 views

Count for Media Library Attachments specified by Categories

I've added this function into my function.php file that allows me to specify images in my media library with categories. /* Add Categories for Media Library Attachments /*------------------------------...
0
votes
0answers
20 views

How can I count the clicks on a button in a post loop list?

This script is fine to count clicks on any button by id or class in a single post type template to save the counts into a custom field. But I want to count the clicks in the loop post list in the blog ...
0
votes
1answer
631 views

Click Count on Download a File

i have website with woocommerce for digital download. I make all free for download, and this my code for download the file: $downloads = $product->get_files(); foreach( $downloads as $key => $...
0
votes
0answers
11 views

The meaning of visit count on admin's bar [closed]

What is the exact meaning of the number that appears when I hover stats graph at admin's bar: For example, right now I can see 9 on one of my sites. And when I click it, I can see following numbers ...
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
0answers
10 views

Limit the word count in the post title in footer for Wordpress

I would like if someone can help me to display the title with read more or ... from the footer of the website, Recent Posts area. Website: https://hygiero.ro/
0
votes
1answer
10 views

display post count in archive page that have relation with another taxonomy term

This topic has been ask in Stackexchange many times. But most of question unanswered or has incomplete answer. My custom post type "Product" and two different taxonomy "Sectors" ...
0
votes
1answer
14 views

If x comments in a post move post to category y

If a post has 0 comments do nothing. If a post has 1 comment move the post to category 1. If a post has 2 comments move the post to cayegory 2. If a post has 3 comments or more move to category x.
0
votes
2answers
38 views

Author post count in category

I want to count authors post count in a specific category. How do i do that? I have red this thread here but still can't fiure it out. Count number of posts by author in a category Edit: This is what ...
0
votes
2answers
838 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
1answer
28 views

Set post title font size automatically according to number of words in post title

When creating a post, i would like for it to check if the post title i set is longer than let's say 15 characters, if it is then i want to change the font size to a smaller size. I am using the Enfold ...
0
votes
0answers
13 views

How to create an html button counter or similar, when user arrive at 5click open ad ad and the same every +5click

I'm new and looking for someone that can explain me how to make a button counter or something similar, when a user click it (and there is a counter near it) and arrive at 5 click when he click the 5th ...
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
31 views

List all categories and count number of posts within based on custom date

I used this solution to count number of posts for each category (list). The counting is based on date post event (only from today's date). I got nothing var_dump show result of new WP_Query . but $...
1
vote
0answers
18 views

How to use wp_query to post count by search term > group post count by date > convert to json. (ex. result 12-21-2020 - 343)

Im trying to create a graph that displays count of post per day and display it on the search result page. Search Example. User searches with the search term "football". The search result ...
0
votes
0answers
6 views

Shortcode My-Listing ho bisogno del conteggio dei post(listings) per ogni Categoria(Regione) filtrata x taxonomia(es:Lombardia)

Shortcode My-Listing theme scusate potete dirmi come creare un shortcode avrei bisogno del conteggio dei post(listings) per ogni Categoria(Regioni) filtrata x taxonomia(es:Lombardia)
0
votes
1answer
26 views

Like and Dislike Buttons on Post with Counter - Only allow one click per post per user session

Working on a "Like" vs "Dislike" for blog post in WordPress. While all is working fine, the intention here is to make it work for guests and logged in users, but more importantly; ...
0
votes
0answers
27 views

Combining old and new 'tags

I have wordpress site that uses tags to represent the amount of workouts a client has been to. That number has become a competitive spark for my clients and they compete with each other. I am in the ...
0
votes
2answers
628 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
24 views

Count tags for a specific category

So I have a simple code that gets the tags and counts them. How would I limit this code to count how many posts are tagged but only include those posts that belong to a specific category? Right now, ...
0
votes
3answers
53 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 ...
9
votes
2answers
6k views

Count & Display Database Queries

I'm looking for an solution how I can count and display all queries in a WordPress site. Does anybody know, if there is an good plugin? Otherwise it would be an solution to check the queries on the ...
0
votes
1answer
24 views

how to count click tab menu and insert to database

I have a tab menu with the following structure, clicking on which will add an active class to the li element Now I need to count the number of clicks of each tab separately and more importantly save (...
0
votes
1answer
3k 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
35 views

Display category filters for custom post type when category is shared by multiple post types

I already have a solution to this problem but I'm wondering if there's a more efficient way to do it. I have a custom post type called "galleries" that uses the same taxonomy as blog posts. ...
0
votes
0answers
33 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
60 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
25 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
54k 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
21 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, ...
0
votes
0answers
11 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
186 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 ...
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
52 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
50 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
8k 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
3k 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
39 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 ...
2
votes
6answers
9k 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
12k 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
49 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->...
1
vote
0answers
880 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
1answer
36 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 */ ...

1
2 3 4 5
7