Questions tagged [count]

The tag has no usage guidance.

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

Count Number of Posts in Taxonomy Term in Last 24 Hours

if anyone could help it would be greatly appreciated, been trying to get this done on and off for a long time and just can't get there. I am using the function below in a loop to count posts within ...
1
vote
0answers
67 views

Apply an Incremental Counter in an Array Function

I'm attempting to incorporate an incremental counter inside an array function, that is, in turn, inside the post's while loop. However, I am only able to get it to count to 1. This is what I ...
3
votes
2answers
53 views

Show weekly posts statistic in WordPress

I create a table in the footer. I would like to show some statistics, like total posts, weekly posts, total posts of the specific category. I just echo total posts with wp_count_posts()->publish; ...
0
votes
1answer
224 views

How to get the total count of Favorite/Favorited authors

I'm trying to get the total favorite/Favorited count for each user, i'm planning to add the counts into author.php to show how many authors Favorited him and how many he favorite others, this the ...
0
votes
1answer
409 views

Display Custom Post Category Count & WordPress Category Count Using Shortcode

I am trying to create a shortcode to display the posts count of a custom post type as well as standard post categories. I have successfully done this using this code snippet from a similar post: // ...
0
votes
1answer
57 views

Counting Posts by Category

I am trying to learn WP Query but finding it a little hard going. I have Posts created from a Forum Plugin (wps_forum_post) and I wish to display counts in descending order based on their selected ...
1
vote
1answer
26 views

Remove ID page from wp_count

I'm try to create a pages counter excluding certain ID pages but the code don't work. I'm using this code. How can I fix it? Thanks. <?php $count_pages = wp_count_posts('page'); echo "$...
0
votes
1answer
2k 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
1answer
422 views

number of posts with “Load More”

I am using the plugin Ajax Load More to query posts and have a filter system to thin out the posts in the loop. I am trying to add a counter that will say "Your search returned X amount of posts" ...
0
votes
1answer
33 views

I have a problem with displaying children pages of custom post type

All I need is to get a number of children pages of a custom post type This is my query: $args = array( 'post_parent' => $post->ID, 'post_type' => 'all_products', 'orderby' => '...
0
votes
1answer
22 views

Sort posts by clicks on download button

In my website each post has a download button for a certain asset. I want to be able to sort my posts by how many times an asset has been downloaded (or, in other words, how many times the download ...
1
vote
1answer
52 views

How can I get global $post to work for CPT and update user?

Ive created a custom field in my user_meta which now I want to update the count each time one the user posts are viewed. Ive got this which works great for standard wordpress posts. However I need it ...
0
votes
1answer
73 views

Get the total Author Favorited posts

I am using the plugin https://favoriteposts.com. To be a little clearer I have posts on my site that have a favourite count as a meta value. I want to get the total favourite count of all posts ...
0
votes
0answers
113 views

Author.php Page views counter

Wondering if some one can help me. Im looking for a page counter for the author.php Ive got about 300 authors on the site and they would like a counter to show them how many times there "profiles" ...
1
vote
3answers
39 views

Count total number across post types

I am using this code to count number of posts for one custom post type. What's the best way to change this to sum up together 3 different custom post types? function get_all_them_ven_posts(){ $...
0
votes
1answer
34 views

Modify the category post counting function

I have a little problem with category post counting. Basically, I made a custom post type, say ‘movie’, using "custom type post UI" plugin, and linked it with built-in category. Also, I am using the ...
0
votes
1answer
24 views

ho can I get the number of the current post instead of the post id?

let say i have these post: firstpost secondpost thirdpost fourthpost if th currentt post is secondpost, I need to return the nr: 2, if the current post is fourthpost, I need to get the nr: 4, but ...
0
votes
1answer
108 views

Set Pagination count according to post count

i have created a php template for a page and displaying posts from my custom post type, but i am skiping posts according to the followed condition. so this is my page template code. $paged = ( ...
0
votes
1answer
161 views

get the count of table rows

What is wrong in my code? It doesn't get the count but it is inserting into the database. function r_rate_recipe() { global $wpdb; $output = array('status' => 1); $post_id = absint($...
1
vote
1answer
99 views

Conditional based on number of specific custom taxonomy terms in archive.php

I struggling to find a way to count and conditionally apply // do stuff based upon the number of terms of a specific taxonomy(ABC) in archive.php... All I have is this below but it counts all the ...
0
votes
1answer
75 views

Problem with displaying HTML content after in_array [closed]

I'm trying to create layout based on this question and answer. First of all, it took me ages to understand why if there's only one post in the category, it's not showing up - so I found out that ...
0
votes
1answer
361 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
1answer
854 views

Implementation to count page visits of unique visitors based on a cookie

It sounds so simple, but I cannot seem to find a simple way to simply count the number of unique visitors of a single page (e.g. by using a short code on that page for a counter or a full PHP ...
1
vote
2answers
943 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
41 views

Display number of post published every day

how can I display the number of posts published daily/weekly ? I don't care about caching, i can even disable it. Obviously if there is a cached way it would be more helpful.
0
votes
1answer
264 views

how to count the current posts terms

Hi i'm trying to figure out how to count the number of terms for the current post, i've tried using wp_get_object_terms() and <?php $title = get_post($post->ID); $numTerms = wp_count_terms( $...
1
vote
2answers
2k views

How can I count post views of REST API calls and update them in an ACF field?

I don't know if I've complicated things a bit, so I'll explain things from the top. I have a set up with a custom post type (news), which is exposed via the REST API. The main endpoint (/wp-json/wp/v2/...
0
votes
3answers
62 views

Counting posts with argument without retrieving the posts

I have a quite extensive database, 30000+ items, and using this: $args = array( 'posts_per_page' => -1, 'post_type' => 'books', 's' => $s ); $post_counts = ...
-1
votes
1answer
427 views

How make animation increase of number

On site wordpress display dynamic number use shortcode in wp-editor, like this: [lifetime] Need make animation increase of number. Maximum value number is not known, because number is dynamic. How ...
0
votes
1answer
506 views

User Published Post Count

I am need to get this function to get user post count where we get published posts within 24 hours, if none in 24 hours then within the week. Ex. David Green - 10 Posts within 24 hours Vivian ...
0
votes
1answer
112 views

Get Author Count By Day, Week and Month

I have a standard loop and I want to by the author's name show how many posts were published for the current day by an author.
1
vote
0answers
18 views

How to update the counter of private pages in the dashboard?

In my dashboard the counter of private pages shows 1, but the list of private pages is empty: Is there a way to recalculate the counters of pages and set them to the proper values?
0
votes
1answer
203 views

Retrieve posts inside foundation tabs and tab-content split by 3 per row

<?php /* Template Name: Page information */ get_header(); ?> <div class="row"> <div class="main-wrap" role="main"> <?php do_action( 'foundationpress_before_content' ); ?&...
0
votes
1answer
59 views

Add subcategories posts to the counts column at the admin's categories list

By default the Count column shows the number of category's own posts only. Instead, I want to see the total number of records taking into account posts in child categories. I know that the get_terms ...
0
votes
1answer
86 views

Count the number of a post types associated with another post type

I have 2 custom post types in Wordpress: Destinations and Tours (so say Paris and Day Trip to Paris). They have a many to many relationship. Now I need to count the number of tours associated with the ...
0
votes
0answers
104 views

Alternative content between posts no repetition

I have the following code which displays some posts on a slick slider and adds a block of content after every two posts. <div class="slick-slider pin-news-ticker"> <?php if (...
0
votes
0answers
346 views

WPDB delivers wrong results from complex queries

I have an issue using Class wpdb a (more or less) complex query in Wordpress 4.7.5. Character set and collation is default (utf8mb4, utf8mb4_unicode_ci) configured in wp-config.php and mysql down to ...
0
votes
1answer
519 views

Alternate custom content in the loop

I have a slick slider scrolling through some posts. I also have a couple of divs displaying between every third slide some some different content like so: <div class="slick-slider pin-news-...
0
votes
1answer
91 views

How to show the number of website visitors in my theme

I have a column in my website's footer where I show the visitors of today, yesterday and all times which looks like this: <p> Today's Views: <span> <!--?php here comes the related ...
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
911 views

Count number of posts by author in a category

What is the optimal method for getting the number of posts by an author in a category? I'm not looking to get the posts themselves, just a count of them. count_user_posts returns a count of all the ...
4
votes
2answers
1k views

Count the number of images uploded on the website

I mention "full website" because I don't need the number of attachments on one post (as answered in many questions). I basically need a function that returns the number of uploaded images (attached ...
1
vote
2answers
72 views

Redirect based on user post count

I'm at a loss.. I wanna check the current users post count. If the post count is 1, the user should be redirected. I have tested the following code: add_action( 'template_redirect', '...
1
vote
2answers
333 views

Query/list all terms and their custom post count

I want to query/list all the terms (from all the custom taxonomies) within a custom post type with their custom post count. This is what I have so far... $the_query = new WP_Query( array( '...
0
votes
2answers
64 views

Trying to add a class to post links

I have a query looping through all posts in a custom post type using a custom order (via a re-ordering plugin.) Here's my code: <?php $current_id = get_the_ID(); $counter = 0; $...
1
vote
1answer
486 views

Enumeration Contact form using database table's numbe of rows [closed]

I am using a shortcode to generate a unique number for each participant in a query using contact form 7. My database name is daviddgl_wp1 and the table name is SaveContactForm7_6. The following is ...
0
votes
1answer
285 views

count post meta values

I have a custom function to count downloaded times for a specific file attached in the post, but i want to display the count of whole post in my website post meta = download_times and how to skip ...
0
votes
1answer
26 views

count_posts to a standalone link

I need to add the post count to a standalone link in my sidebar. Just a custom link in the textfield widget, "All posts". How can i add a count of all published posts to it?
1
vote
0answers
209 views

Count Published & Draft Posts Associated With Each Term

I am already doing a get_terms query to get all of the terms that are for a related taxonomy. if(!empty($slug)) { $terms_args = array( 'orderby' => 'name', 'order' =&...
0
votes
1answer
86 views

Columns depending on posts count

What i would like to do; if there is one post in custom post type, it should show up in one full column of bootstrap. | post | If there are two posts, they should show up in two half column (...