Ce plugin est une autre extension de StatTraq de ma cr?ation, donc n’oubliez pas de t?l?charger StatTraq. Ce plugin r?cup?re les articles les plus lus de la table de StatTraq et les affiche selon le format de votre choix.
T?l?chargez le jetez un oeil au code source)
D?compressez le fichier et mettez le dans votre dossier wp-content/plugins, puis activez le dans l’interface d’administration.
Pour utiliser le lugin, vous devez mettre le code ci-dessous dans votre fichier index.php.
popular('cha?ne',entier);
?>
O? ‘cha?ne’ repr?sente le format de sortie que vous souhaitez obtenir. La cha?ne par d?faut est :
‘
‘
Dans cette cha?ne, %u sera remplac? par l’url de l’article, %t par son titre, et %v par le nombre de fois que cet article a ?t? lu. Il est ainsi tr?s facile de choisir le format de sortie que vous souhaitez.
Le deuxi?me param?tre (un nombre entier) d?finit le nombre d’articles que vous souhaitez afficher.
Versions
0.1: Premi?re sortie
0.12: Devrait fonctionner avec toutes les structures de parmaliens, merci de me faire savoir si ce n’est pas le cas. Applique le filtre pour ‘the_title’.
11 Responses to “Articles populaires”
RSS feed for comments on this post. TrackBack URL









I can not get this to work. I know it is so basic… I put the file in the plugins dir activated it (done that a 1,000 times lol) then i get confused whith your directions should i put [code] < ?php
popular('string',int);
?>[/code] where I want it on my page.. i have tried that but I get [code]"
Database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'int' at line 1]
SELECT COUNT(*) AS cnt, article_id, url FROM wp_1stattraq WHERE user_agent_type=0 AND article_id!='feed' AND url LIKE '%name=%' GROUP BY url ORDER BY cnt DESC LIMIT 0,int
"[/code]I have no idea i tried lookin at the plugin code… Any Ideas!
–>
Comments [...]
Hi,
Am using WP1.5 and used the function like this:
< ?php popular(); ?>
But got this error:
WordPress database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE user_agent_type=0 AND article_id!='feed' AND article_id!=]
SELECT COUNT(*) AS cnt, article_id, url FROM WHERE user_agent_type=0 AND article_id!=’feed’ AND article_id!=0 GROUP BY article_id ORDER BY cnt DESC LIMIT 0,5
Warning: Invalid argument supplied for foreach() in /home/kelvinw/public_html/journal/wp-content/plugins/most_popular.php on line 88
sorry, looks like the php script dissappearred.
Anyway, I used your script like this:
popular() (within the php tags of course)
Sorry my fault, did get stattraq installed properly!
i don’t get it, what value that can i use for the string command ?
Used this plugin exactly as directed with the simplest setting. Getting this error: “Warning: Invalid argument supplied for foreach() in …/wp-content/plugins/most_popular.php on line 88″
Have decided to uninstall the plugin. StatTraq is installed and running fine.
I rewrite this script to work. If anyone unstaisfy with this, mine may help you.
http://softwitch.net/blog/index.php/pop-post/
Great stuff Jiyul, thanks a lot. I urge all those for whom the plugin doesn’t work to try that one. I’m not developping or supporting these old plugins anymore, so it’s great to see that somebody has finally decided to rewrite and improve one!
Hi, it’s because when you call the
popular_posts(string,int)function , you have to replace ‘int’ and ’string’ by the number of posts you want to show and the format you want to show them in, respectively. That should do the trick.