Articles populaires Comments RSS feed

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 :

  • %t (%v views)
  • 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’.

    Liked it? Share it!
    • del.icio.us
    • Facebook
    • Google
    • TwitThis
    • StumbleUpon

    11 Responses to “Articles populaires”

    1. [...] e views, not the actual posts viewed by your visitors. It also confuses the hell out of my Popular posts plugin, forcing me to use mad hacks to have it report the correct t [...]

    2. littleman09z says:

      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!

    3. [...] ?php popular(‘%t (%v views) , nombres d articles visibles ); ?> sources

      –>

      Comments [...]

    4. Kelvin Wong says:

      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

    5. Kelvin Wong says:

      sorry, looks like the php script dissappearred.

      Anyway, I used your script like this:

      popular() (within the php tags of course)

    6. Kelvin Wong says:

      Sorry my fault, did get stattraq installed properly!

    7. rakhmat says:

      i don’t get it, what value that can i use for the string command ?

    8. 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.

    9. Jiyul says:

      I rewrite this script to work. If anyone unstaisfy with this, mine may help you.
      http://softwitch.net/blog/index.php/pop-post/

    10. Jonathan says:

      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!

    11. Jonathan says:

      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.

    Leave a comment

    If you register, these will be filled automatically