Artiss README Parser: README file could not be found or is malformed - Count Posts in a Category
Hi, can the plugin also count posts for a tag?
It can now, I just pushed a new version (2.1) which has the tag="" argument. So you would use it just like the regular shortcode except you would replace cat="category-slug" with tag="tag-slug". You can also use IDs or names the same way if you specify a type="" argument.
Thanks for the good idea!
Would love to have this for custom taxonomy as well…
Haha, you guys are tough customers! This is easily doable, but I think the shortcode is going to get too confusing if I add any more attributes. I’ll tell you what, I’ll preserve the current functionality so nothing breaks, but I’ll add some additional shortcodes to make it less confusing. I will add
[term_count taxonomy="custom-taxonomy-name" term="tax-slug/name/id" type="slug/name/id"]
Because this will require the additional paramater of taxonomy=”custom-taxonomy-name”, I will put it in a separate shortcode.
Or maybe I should just make a new one altogether…
Hi, i wanna know how would you write the following shortcode in php
As we talked about via mail;
It would be great to have a sum of all posts for a specific category, f.e. [tag_count id="45,85,34"] would give you a sum of all the posts in those categories.
This feature is added as of version 3.1. It only works for IDs and slugs (since a name could ostensibly have a naturally occurring comma).
Thanks for the great idea, I gave you credit in the readme.txt!
I thought I had this working for me in a widget, but after deleting some other plugins today it no longer works. I can get the code to work for me inside a post, but not inside a widget. Should it be able to do both?
Are you inserting the PHP function <?php do_shortcode( 'cat_count id="44"' ); ?> directly into the widget’s code; or are you just typing[cat_count id="44"] into a widget like you would in a post?
<?php do_shortcode( 'cat_count id="44"' ); ?>
By default, NO shortcodes will work inside of widgets or in comments. To make shortcodes work outside of posts and pages, you need to add the do_shortcode action to the relevant filter (in this case the widget_text filter).
So either add the above listed PHP into your widget, or add this line to make ALL shortcodes work inside of the body of the text widget: add_filter( 'widget_text', 'do_shortcode' );
add_filter( 'widget_text', 'do_shortcode' );
Awesome – thanks for the taking the time. Worked by adding the line into the theme functions and then [cat_count name="cat_name"] into the widget, though I couldn’t get the php line in the widget to render anything.
You still won’t be able to paste PHP directly into the widget, just shortcodes, if that’s what you’re talking about.
If you need to put PHP into the widget text, you’ll have to use your own callback function and hook it to the widget_text filter.
This subpage explains how to include future (scheduled) posts in the count made by this plugin.
hi, does this also work on custom post-types?
im trying to get it to work for a custom post type categories, but it returns 0
Yes it does! You have to use the format
[tax_count tax="taxonomy-name" slug="taxonomy-slug"]
And replace the “taxonomy-name” with your custom category name and the “taxonomy-slug” with the slug of that custom category.
Can I use this plugin to count posts that have a specific category AND a specific custom taxonomy value? Thanks!
Is it possible to insert counting of posts in WP 3.5 menu ?
You’ll have to enable the shortcode filter for menus in your theme, just wrap any section you want to be shortcode aware in the PHP code below. If you want it in your navigation menus, the simplest way is just to find wp_nav_menu( $args ) function wherever that appears in your theme (it may have an array inside of it or variable other than $args) and wrap it in the do_shortcode() function.
wp_nav_menu( $args )
< ?php do_shortcode( wp_nav_menu( $args ) ); ?>
how to continue after I put the code < ?php do_shortcode( wp_nav_menu( $args ) ); ?>…
Im lost and pulling my hair..
sorry for maybe being dumb..
thnks a lot!
(Dashboard) » Appearance » Editor
or just append /wp-admin/theme-editor.php to your blog url while logged in.
How do I get this plugin to work inside a text widget?
To make your Text widgets shortcode aware, you just need to add the do_shortcode() function to the widget_text filter. Just paste:
somewhere in your theme’s functions.php file.
on the wordpress support forum for your plugin … here:
you are posting a link to your support page… unfortunately it returns a 404 error.
Might want to look into that.
Hope it helps.
Link has been updated and broken redirect has been fixed. Thanks for catching that!
I am not sure if this is implemented, if not please take this as a feature request.
Can I “query” different categories with AND or OR relationsships?
I see that you can do e.g.:
But can i do:
COUNT number of post in category 1 AND 2.. but NOT if they are category 3 ?
This is something which would come handy for us as we have posts which are in multiple categories and we would like to filter out duplicate counts.
An example of such “query syntax” can be seen on another plugin we are using ( it displays the posts in certain categories).
Please go here:
and you can see how the author implemented “Include AND”, “Include OR” and “Exclude” queries.
Hope this helps.
Can this perhaps be done already? if not would be great if you could consider this.
I can’t get this to work. I’m using the shortcode in a post, and it’s returning a “0.”
It would be possible to add AND operator (+) for category count?
Example: I need to count posts only if are presents in CATEGORY 1 [AND] CATEGORY 2.
In WordPress, I can use + sign, but if I use with latest version of plugin, I get 0.
It would be possible to add this feature?
You are not around here??
Any news about last suggestion?
I am using the php code and it wont show up
Had some trouble getting your “do_shortcode” example working, fixed it by changing to
I would like to add a count in my site every catergory menu as You can see in here: http://penyigeydesign.hu/herbertcollection/
Now it is manualy. Your plugin can help me?
Sorry for my english!
Your email address will not be published. Required fields are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>