Questions tagged [count]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
300 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
227 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
93 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 (...
0
votes
1answer
43 views

How to prevent authors from editing their post count?

The number of views is something I am very concerned about as it helps me understand how many people actually read the posts. I have bloggers working with me who may fake their article's popularity ...
0
votes
1answer
110 views

Pull posts from all categories if quantity is not met?

I have a modified theme that displays CPT posts. I am creating a slider that will cycle through all the sticky posts and display them at the top of the page. So far so good. The problem. When I ...
1
vote
2answers
149 views

Count posts with specific term_meta

I have a custom post type that have many taxonomies. In the front end, a user can assign a 'category' (term_meta) value to the taxonomy - hardware or software. I wanted to be able to count how many ...
0
votes
1answer
22 views

CountPost WordPress Custom Taxonomy

What's the easiest way to add "count posts" to the category listing as seen as below? <?php if($categories){ foreach($categories as $category) { $output .= '<li><a href="'....
0
votes
0answers
21 views

Getting the comments counter back to 0? [duplicate]

I have/had 72K comments to get rid of from a site that were re-surrecting from a few years ago. It appears the physical comments are gone but I can't get the counters to read 0. Plus, it still says ...
0
votes
0answers
234 views

counting post from a wp-query using sticky_post

I'm trying to count the number of sticky_posts inside a specific category. first I get all the sticky posts : $sticky = get_option( 'sticky_posts' ); then here are my args : $args_sticky = array( '...
2
votes
2answers
920 views

Count number of published posts by type

I have this code, but it shows the total number of posts published by post type 'code'. <?php $count_posts = wp_count_posts('code')->publish; echo $count_posts; ?> I have 2 post types: '...
0
votes
1answer
101 views

How to control Post view count incresing in sidebar widget posts too?

I've this code for post count, it almost works for me but, when i apply <?php echo tie_views();?> in recent, popular or related posts lists. post counts increase there too. I want to control it ...
0
votes
1answer
2k views

Woocoomerce product category count including subcategories

I'm overriding wpseo_title to make custom titles for my Woocommerce product categories. Part of the titles are the number of products, based on $product_category->count The only problem is that ...
1
vote
1answer
40 views

How to make sure content doesn't display if selection is empty

I have a variable called $speakers that displays a list of speakers for an event when selected from a drop down list. The problem is when none of the speakers are selected for an event, the list of ...
0
votes
1answer
100 views

For each 3 posts, show a different post type

I would like to do 3 posts of post_type "daily" and between them a different post_type "quotes" I would like to do 3 by 3 like for each 3 daily, show a post_type "quotes". How can I do that?~ ...
1
vote
2answers
1k views

How to count custom post types with conditional operators

I have a custom post type that I want to use an if/elseif/else statement with. If post count of post type is equal to 1 do X, elseif post count is greater than 1 do Y, else do Z. This is the code I'...
0
votes
2answers
329 views

How to count other posts not having specific taxonomy terms?

I have a custom post type "book", and a taxonomy "language" with terms "php" , "java" ,"c", "python". I want to count "book" posts not having terms "java" & "c".. such that posts with only "java" ...
0
votes
1answer
566 views

Wordpress Count posts within a custom post type

How to WordPress count post within this code. <?php query_posts('showposts=6'); ?> <?php $posts = get_posts('numberposts=6&offset=0'); foreach ($posts as $post) : start_wp(); ?> <?...
2
votes
2answers
1k views

Number of items in a menu

I can't find if WordPress stores the number of items in a menu. Basically I need to find out how many items are in a menu to work out the percentage each item should take up in the header bar. Is ...
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 &...
2
votes
1answer
2k views

How to get the number of child categories a specific parent category has?

How do we count the number of child categories of a parent category? I am using a custom taxonomy, called: "authors". I found this code, which does count the number of child categories, but only ...
0
votes
1answer
2k views

How to change post count in wordpress loop?

Hey I am attempting to customize my WordPress post loop to create different post styles for a certain set of posts. For example the first three posts would be styled in it’s own way, the next four ...
0
votes
1answer
454 views

How to count the number of archives there are

Is there a way to count the number of monthly archives? For example, my site has the 3 monthly archives (jan 2016, feb 2016). So the number should be 2. How I can display the count. PS: I want to ...
0
votes
1answer
72 views

Add estimated value for a post according to the number of words

I have a blog where paid by 2 cents per word, need to add next to the word count one text value of statistics. Anyone have any idea how to make this automatic multiplication along with the word count?...
0
votes
1answer
99 views

conditional based upon the count of current user's published custom posts

I have this conditional snippet that does something is the current user has not published a normal post. But I'd like to change it so that it counts a custom post rather than a normal post. <?php ...
0
votes
1answer
571 views

How to display author post count for multiple custom post types?

On my theme author.php page I have a number of posts displayed but it only count posts of the type 'post', I need it to count multiple post types. I think they are trying to make this core but no ...
2
votes
1answer
494 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';...
1
vote
1answer
237 views

Count comment threads, not total comments in a post

For a post I'd like to count the comment threads and not include nested replys in the count. Currently I'm using a simple comment count, comments_number( $zero, $one, $more ); What would be the best ...
-2
votes
2answers
75 views

How to show the amount of post that have on the site?

How can I make a code show the number of posts you have on my site, adding all fair categories??
0
votes
2answers
759 views

How to read out the excerpt length (for if-condition)

I'm trying to do is the following. If the excerpt length is shorter than 30 charakters, than do.. <?php if ( get_the_excerpt() <= 30 AND has_post_thumbnail() ) : ?> <div></div>...
0
votes
1answer
311 views

WP_Query count of different meta key values [duplicate]

I need to get count of different values of meta_key: Let's say I've got meta_key $class & there's only three different values: 1, 2 & 3. //My WP_Query $ads = new WP_Query(array( '...
0
votes
1answer
485 views

How to add together (get the sum) a field from all author's posts

Using the plugin WPeddit I want to count the epicredvote score from all posts of an author together to get the sum. The following is a custom field that puts out a score, like "3" or "-2" or whatever:...
0
votes
2answers
1k views

(get_post_ancestors == 2) is returning true on 1 as well?

I am trying to use this code: <?php if(count(get_post_ancestors($post->ID)) == 2 ) : ?> <script>...</script> <?php endif ?> to add a script to a page but only if ...
3
votes
1answer
3k views

Count posts in category including child categories

I have found this code somewhere, it counts posts but only which are under specific category. I would appreciate if someone could expand this so it would count all posts which also belong to its child ...
0
votes
1answer
964 views

Add “showing posts x to x of y” in custom post type paginated loop

Is there a way that I can add "Showing posts x to x of y" into a paginated custom post type loop? So for example if I have 100 posts I'm showing 10 posts per page, on /page/3 it would show "Showing ...
-1
votes
1answer
1k views

Adding Count Post in Page

Question : how to display post count in a page like this picture : Showing 25 of 123 products I mean in general. I use the custom theme and create a page that contains Categories. How to display text ...
0
votes
1answer
34 views

Custom Looping of Wordpress Posts

I have been working on a Wordpress theme from few days. I want to achieve modern like layout in my theme's frontpage. But I am having no clue that how to achieve it. Now my wordpress theme loops ...
1
vote
4answers
153 views

count_many_users_posts except current logged in user?

Is there a way to count and show the count of all author posts in a custom post type except the current logged in user? I was hoping there's a way to do it with count_many_users_posts but it doesn't ...
1
vote
2answers
78 views

Counter of posts ever posted - even deleted ones

I'm trying to figure out how can I display the amount of posts ever posted - not only the currently published, draft + pending etc ones, but even the deleted ones. I assume that there has to be ...
0
votes
1answer
50 views

How to limit the number of posts a user can view based on status

I would like to create the subscriber system with the following status for the user: active and pending. So, for the pending status user only can read 3 articles for free. I created using php file and ...
0
votes
1answer
570 views

Get total views of all posts by author

I would like to display the total amount of views per author for all posts. What would be the best way to achieve this without causing too much load on the server?
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 ...
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. ...
0
votes
2answers
2k views

Display Published Posts Count for Certain Time Period

I need some kind of plugin (if it exists) or a wp query which would display number of posts published within a certain time range. For example: I need to know how many posts have been published ...
1
vote
0answers
631 views

check if author has published posts in custom post type, then send mail

I have a site where people can submit drafts to a custom post type from the frontend. Once a user submits the form, a new WP user is created. If the user is logged in the submitted user e-mail ...
0
votes
1answer
70 views

Counter is skipping post when I still want it visible [closed]

I am showing the 5 latest posts on my homepage. I am using a count so that on the 3rd post it shows a div which will be completely seperate to the blog posts. However rather than the 3rd post ...
0
votes
2answers
734 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="...
1
vote
1answer
186 views

Limit tag word count

I want to limit user to enter post_tag only words of two not more that. If any of the tag is more than two words the user caanot publish the post. I need to use this function to count word. function ...
1
vote
1answer
3k views

Get Gravity Forms field values and count how many? [closed]

I don't know how to explain this the best way. But, I am using a form in Gravity Forms for rating something 0 - 10. In the code below, I can get the results. However, I need to see how many ratings ...
-1
votes
2answers
386 views

Having problems getting the number of plays in a WordPress Playlist from an audio file

I have already seen a similar post here: How to get the number of times an audio file has been played But the code provided by @bonger did not work for me. I uploaded the new functions.php with the ...