Latest Version: CountPost 2.0
CountPosts V 2.0 a for latest WordPress versions from 2.5 to 2.6.2
Now it don’t count post from all users with user-level 8, (admin permissions), so it will not count visits from whole admin team, not just one admin person like older version
CountPosts V 1.1 Beta for WP 2.0
CountPosts is plugin for WordPress Blog. It’s very easy to install and use.
This plugin count visits on your blog, but not when u are log-in as admin. Also count visits for every post separated, and u know in every moment how many people read your posts. U can see what is the most read post in your blog. Also when u read your posts, CountPost won’t count your visits.
CountPost make u list of the most read post, with hits for every post separated.
Installation:
1) Add CountPost.php in Plugin folder
2) In Plugins section, click on the activate button for CountPost plugin
3) Add
-
<?php HitThisPost(‘Hits for this post:’, ”); ?>;
in index.php or single.php (It depending of your Theme you using) somewhere before comments or where ever you like. First and second attribute can be changed.
4) Add
-
<?php mainCounter(‘Visits: : ‘, ‘ .’); ?>
in sidebar.php First attribute is print before visits number, and second is after visits number
5) Add
-
<?php TopHitsList(); ?>
somewhere when u want to show top list of read posts.
Using TopHitsList(); function
-
<?php function TopHitsList($beforeRead = ‘ (‘, $afterRead = ‘ ).’, $top = 5, $beforeAll = ‘<ul>’, $beforeLink =‘<li>’,
-
$afterLink = ‘</li>’);
-
-
<?php
-
function TopHitsList($beforeRead = ‘ (‘, $afterRead = ‘ ).’, $top = 5, $beforeAll = ‘<ul>’, $beforeLink =‘<li>’,$afterLink = ‘</li>’);
-
-
-
/*$beforeAll – print before all.
-
$afterAll – print after all.
-
$beforeLink – print before post link.
-
$beforeRead – print after post link and before hits.
-
$afterRead – print after hits.
-
$afterLink – print after $afterRead*/
-
?>
-
- POST NAME1 (HITS 1 ).
- POST NAME2 (HITS 2 ).
- POST NAME3 (HITS 3).
…
Sample of using TopHitsList() function
-
-
<?php
-
//in unnumbered list
-
TopHitsList(‘ Read ’,‘ times.’, $top = 5, ‘<ul>’, ‘<li>’, ‘</li>’, ‘</ul>’);
-
-
//in numbered list
-
-
TopHitsList(‘ Read ’,‘ times.’, $top = 5, ‘<ol>’, ‘<li>’, ‘</li>’, ‘</ol>’);?>
Output will be something like this:
POST NAME1 Read 12 times.
POST NAME2 Read 34 times.
…
Older version problems:
- Version 1.0 don’t work if your blog use Revrite Rule. Now it works even if your link structure looks like this : www.yourblog.com/blog/2006/04/04/sample-post/
- When activate some other plugin, you had error: WordPress database error: [Duplicate column name ‘post_hits’] . This error wasn’t making any problems, but it was annoying.
Download Latest version:
Download CountPost for WordPress 1.5
Download CountPost for WordPress 2.0
Update 5. April 2006
New version 1.1 Beta is hire. I fixed some bugs in 1.0 version:
If u have any problems, suggestions for this plugin contact me.
95 Responses to CountPosts v 1.0 – WordPress Plugin
Ivan Ðurđevac октобар 6, 2006
Ellen,
Add this code into your index.php in the loop.
More about the loop at
http://codex.wordpress.org/The_Loop
[code]
< ?php
if (is_single()) {
TopHitsList(' Read ',' times.', 5, '
', '- ', '
', '');
}
?>
[/code]
Ellen октобар 6, 2006
Oke, Ivan, I will try that!
I’m at work now, but I will let you know the result!
Ellen
Ellen октобар 6, 2006
Hi Ivan,
It’s not working…
I’ve read about the loop, but I don’t know exactly what to do, because nothing is happening…
Here’s my index.php:
“>
“> ” rel=”bookmark”>
‘, ”, ”, ”);
}
?>
Edit‘));?>
–>
Ellen октобар 6, 2006
ohw… that’s not working either!
“>
“> ” rel=”bookmark”>
‘, ”, ”, ”);
}
?>
Hits: ‘, ”); ?>
Edit‘));?>
–>
Roel октобар 10, 2006
Ivan,
thanks for your reply; I’ve used the code, but I would prefer not to show the number of times the article has been read. Right now I have:
- article 1 (500)
- article 2 (498)
I would like to show:
- article 1
- article 2
Would this be possible?
Whisper новембар 5, 2006
I love your plugin it is exactly what I was looking for and it works wonderfully.
I run a website for a non-profit organization, and would like to keep stats on which of our adoption listings are being veiwed most each week.
I am going to look at this myself but I’m struggling a bit.
Would you know a way to get it to clear the stats automatically at the end of each week so that I have fresh stats for the following week. Like say make it reset the stats on Saturday night at a certain time.
If you could help me with the query that would accomplish this I could help create an admin page so that folks could turn the feature on or off. I’m just not good with date functions *blush*
SabbeRubbish новембар 9, 2006
Dear,
The plugin is great, but I have one small comment.
Everytime The Loop goes around (10 posts on front page for example), every post on the front page gets its post_hits incremented. Thats not really what I though it would do, so i suggest the following code change:
function HitThisPost($before = '', $after='', $detailed_view = true) {
global $wpdb, $table_prefix, $wp_query, $current_user;
$p = $wp_query->post->ID;
if ($p)
{
$Update = "Update " . $table_prefix . "posts set post_hits = post_hits + 1
WHERE ID=" . $p ;
//echo $current_user->wp_capabilities;
//if (get_profile('user_login') != 'admin')
if(!current_user_can('level_2') && $detailed_view)
$wpdb->query($Update);
$SQL = "SELECT post_hits FROM " . $table_prefix . "posts WHERE ID=" . $p;
$red = $wpdb->get_row($SQL);
echo $before . $red->post_hits . $after;
}
}
So on the index.php you use the third argument false and on the SinglePost.php (for example from Almost Spring), we use true as the third argument.
Let me know if you think this is interesting.
Greetings,
SabbeRubbish
Juixe TechKnow јануар 17, 2007
Hi – I also agree with SabbeRubbish in the above comment. This is a kewl plugin but I needed a way to reveal the count in the index.php of al the posts without having the count increase for each post! I hope you add the above fix in an official release. Thanks for the plugin!
MrAnderson јануар 18, 2007
Great Plugin… I’ll sugest and option page for reseting post_id… I’ve changed the post-slug of a post after it was published, so the plugin is still pointing to the old post-slug… don’t know how to solve it. Greeting
Ivan Ðurđevac фебруар 13, 2007
Soon i will write a new version of this plugin, and it will have more features like reseting counts for some post, and other from above comments…
Thanks for your suggestions!
Benji март 12, 2007
I install it but it doesnt count, everything on the db seems alright… what could be?
erick март 25, 2007
i have this error
Parse error: syntax error, unexpected T_FOR in /home/.monatana/todhirsch/realdealcostarica.com/wp-content/themes/oficentroweb/single.php on line 18
and in the line 18 i put
;
please if someone know why, please letme know
10nx everybody
haxxor април 27, 2007
I’m getting the same error as erick after upgrading to Wp 2.1.3. what is the solution? is there an update for this plugin?
thanks
search engine marketing services in spanish мај 31, 2007
Hello Ivan,
It seems to be a great plug-in, i have several blogs using WordPress 2.2 and 2.1.3, and I´d like to use it, but it seems that there are some problems, is there any compatibility problem with recent versions? or do I have to wait for your upgrade?
I see that you provide an excellent support to all of your fans, I would appreciate your comments.
Thanks.
Roman јул 17, 2007
hello, can this plugin shows top posts of the actual month? if yes, how can I modify that? thanks. Roman
Meonx август 6, 2007
I have a problem curent instaling this plugin ata mine
Peter Schwaiger август 15, 2007
Hi there,
first of all – thx for the great plugin. I am just puttin up my first blog. Installed CountPost under WP2.2.1 and it works great.
BUT – I also installed the Language Switcher WP-Plugin (http://poplarware.com/languageplugin.html) today to create a switchable English/German blog. Everything still works, but the ‘TopHitsList()’-function (as you can see here: http://www.autlawmusic.com/archiv) does not.
I told the programmer of the LS-Plugin and this is her reply:
“You will have to make sure that whenever the
other plugins (in their PHP code) put information on the screen (such as post titles), that the plugins “filter” the information using the standard WordPress filters. If you are a PHP programmer, I can point you to some resources on the WordPress site to learn about filters, and you can fix the plugins. If you are not a PHP programmer, then your only recourse is to try to explain to the plugin authors that
they should always use the standard WordPress filters when putting out information, and hope they fix it.”
Your countPost Plugin is really very cool – so my question: Is there a chance, you make use standard WP filters in one of the next versions?
Thx & Greetings,
Peter
problemlöser август 29, 2007
I know from my own experience that one only recieves bug reports and never just a pure, innocent “thank you” – but tonight I will change the game:
Thanks for the plugin. I installed it and it just works fine!
MrAnderson септембар 6, 2007
Great plugin!! I use it on my blog… only one problem… I’ve changed the permalink structure of the blog, but the CountPost database didn’t change so I’m receiving 404 error when clicking the link provided by CountPost plugin… any chance of a new version with Option Panel for rebuilding the permalink structure in CountPost database??
Manele септембар 11, 2007
i just installed this plugin on my blog and i love it! thank you!
MrAnderson октобар 12, 2007
I solved the problem of permalink change… you have to edit this awesome plugin and change the part where the SQL calls for “guid” field, for get_permalink() function…
It should be like this
echo $beforeLink , “” , $top->post_title , ““, $beforeRead , $top->post_hits , $afterRead , $afterLink;
And problem solved… greetings
MrAnderson октобар 12, 2007
echo $beforeLink , "" , $top->post_title , "", $beforeRead , $top->post_hits , $afterRead , $afterLink;Manele Noi новембар 25, 2007
Usefoul Plugin
Muzica новембар 25, 2007
Thanks, i like it
Rim децембар 12, 2007
Thanx from Ukrain =) Simple nice plugin
sağlık децембар 15, 2007
nice good job…
thanks
www.r10.net küresel ısınmaya hayır seo yarıºması децембар 27, 2007
Nice good
Frank Lucas јануар 5, 2008
WordPress: v2.3.2
MySQL: v5.0.45-community-nt
PHP: v4.4.7
Server: Microsoft-IIS/6.0
Firefox v2.0.0.11
Plugin activates but throws error on page.
Regards.
new software јануар 6, 2008
thanks good
Muzica Noua јануар 31, 2008
I have a website but i dont know how to instal a blog on him….can you help me?
arabalar јун 25, 2008
thank you for codes.
SEO јун 28, 2008
thank you
hekimboard јул 1, 2008
thanks yusufum…it is hekimboard..
free java games јул 5, 2008
nice plugin
hekimboard јул 7, 2008
thanks friends..
dıs cephe јул 9, 2008
thanks friends..
free download mobimb септембар 12, 2008
thanks also
Carlos José Teixeira октобар 3, 2008
Nope, doesn’t work on wp 2.6.2, chrometweaks template.
Tryed to place it on index.php, single.php and page.php. The result is allways the same, as in index.php:
«Parse error: syntax error, unexpected T_FOR in /home/deictorg/public_html/fractura.net/wp-content/themes/chrometweaks/index.php on line 41»
But maybe I’m being stupid. What I’ve made was simply paste de code as follows
;
to the file, under the comments php.
Is it necessary to do anything more?
Would you be kind to send me an e-mail regarding this issue?
I think it’s a great tool and it’s a pitty I can’t use it.
Regards,
CJT
Simon октобар 14, 2008
Hey Ivan, thanks for the plugin. I was wondering if I could exclude a category from the output and vice versa. How can I get in touch? Thanks,
Simon
Juliano новембар 26, 2008
Hello buddie,
I installed this plugin long time ago in my blog and everything was doing good… until I changed my permanent links. Now the lins in the top posts list are all wrong, and I don’t know how to change this.
Here is the page:
http://j.ajamil.blog.br/as-100-mais-lidas
Help, please
ARTI јануар 8, 2009
Thanks you very much. Would you know a way to get it to clear the stats automatically at the end of each week so that I have fresh stats for the following week. Like say make it reset the stats on Saturday night at a certain time.
Güvenlik Sistemleri фебруар 24, 2009
thanks a lot.
Marius Bancila фебруар 25, 2009
This doesn’t work for 2.7.x. Since I’ve done the upgrade to this version, all my posts have 0 hits. What’s the problem?