Navigation Advertising

Next post Previous post

Post content

Plugin: Posts in category 1.1

Wordpress

This is my very first Wordpress plugin ;-)

The plugin shows a customizable list of links to the posts published in the specified categories (also multiple ones).

You can show posts from one or more specific categories, by passing an array of their IDs as a function value, or show other posts from the categories under which the currently active post is published (as I do in my sidebar!).

You can see the plugin code here. If you copy this code and paste it into a .php file, you’ll have the plugin ready to rock!

The features list include:

  • Show posts published under one or more categories (also the current post’s one if you wish).
  • Limit the number of shown posts.
  • Customize the order in which post links will be shown.
  • Exclude posts (from v.1.1)

Using this plugin is simple: install and activate it easily as usual, then call the function, inside The Loop, with this syntax:

echo mp_posts_in_cat(’categories-array’,'post-limit’,'order-by’, ‘exclude’);

Let’s explain briefly these arguments:

  • categories-array is an array containing the IDs of the category of which you want to display posts;
  • post-limit is the number of the posts link you want to show;
  • order-by is the criteria for which you want to order posts by (that is no other from your POSTS table field names, comma separated);
  • exclude contains IDs of the post to exclude. Can be a numeric string, array or empty.

You will find extended documentation and usage examples directly into the plugin source code.

This plugin is released under GPL license.

Special thanks goes to:

Mrbrown, that gave me the initial input for plugin development (in this forum topic), and the whole Wordpress italian community that made this possible.

Bookmark:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • digg
  • del.icio.us
  • blogmarks
  • co.mments
  • NewsVine
  • Furl

Related articles

Other posts filed under Wordpress

Comments and trackbacks

18 comments for “Plugin: Posts in category 1.1” (RSS)

  1. Zelig wrote:

    Plugin molto interessante, da tempo cercavo qualcosa del genere! Pensavo di utilizzarlo nella pagina di visualizzazione dei singoli post (single.php) e mi chiedevo se per caso conosci un modo per modificare la query in modo da escludere dall’elenco l’articolo correntemente visualizzato. Grazie! :-)

  2. root@geek-notes.com wrote:

    Grazie del suggerimento, Zelig.
    Ho modificato il plugin in modo da poter escludere il post corrente (basta passare $post->ID come quarto argomento) e ho fatto qualche altra piccola modifica alla funzione (che ora va stampata dal template e non stampa lei direttamente… vedi i commenti alla funzione e il changelog).
    Ciao!

  3. Zelig wrote:

    Grande! :-D

  4. Mateus Neves wrote:

    This plugin is very nice… Tanks!

  5. Iva wrote:

    Grazie mille per questo plugin! Usavo uno che era simile, ma non lavorava con Word Press 2.0. Questo mi aiuterà molto, con organizzare le categorie sul sito che è troppo grande:)

  6. pietro wrote:

    non potresti inserire degli esempi pratici di come si usa, non tutti siamo programmatori, io ad esempio non ho capito se va inserito all’interno del template e dove, e quali parametri passare

  7. KJ wrote:

    Will this work with the latest version of wordpress?

    Thanks

  8. KJ wrote:

    Also would it be possible to show the Title, Date and excerpt for each posts? Would those just be included in the query in the source code?

  9. Alessandro wrote:

    ciao maurizio
    questo plugin sembra veramente ottimo e mi sarebbe utilissimo. ho visto la documentazione e anche il materiale di partenza su WP-it ma non riesco a farlo funzionare. sono alle prime armi ma imparo in fretta. puoi mandarmi qualche esempio?
    grazie, a presto,
    alessandro

  10. LolitochkaBC wrote:

    Ð?аану-ка ребÑ?трки олÑ?уем!!!

    ПризнавайетÑ?ÑŒ проказники и владлеьцы Ñ?йата www.geek-notes.com ))))

    ЧТО вы будеате делать Ñ?тим летом!?

  11. Rafa wrote:

    Dear Mauricio, I have copied the text of http://www.geek-notes.com/files/wp_plugin_posts_in_category.htm and saved it as post_in_category.php. I’ve uploaded it within a folder in plugins, activate the plugin and so far everything went well. But, now I’ve copied the code
    cat_ID);
    } ?>
    Last posts from the same categories of this post
    ID);?>

    into a post, and further I’ve copied and pasted the code
    echo mp_posts_in_cat(’categories-array’,'post-limit’,'order-by’, ‘exclude’)
    into my “single post” theme inside the “loop”, but that has completley messed up my word press and made mysql to get stuck.
    could you please be a little more clear about how exactley all this has to be done. I’m not used to php at all, so in the user instructions you should state the exact postion and format where all the code has to be put for this to work.
    Thanks from a “not-at-all-geek”
    Rafael

  12. Rossi Alex wrote:

    Simply perfect for all SEO.
    Good job.

  13. Dario wrote:

    Bellissimo, “pareva” funzionarmi, ma mi ha dato una fila di errori quando ho fatto il logout da wordpress (vers.2.2.1), e anche quando provo a fare login!!!

    Copio di seguito:

    Warning: Cannot modify header information - headers already sent by (output started at /home/mhd-01/www.giorgionecalcio.it/htdocs/wp-content/plugins/ArticoliCategoria.php:2) in /home/mhd-01/www.giorgionecalcio.it/htdocs/wp-login.php on line 12

    Warning: Cannot modify header information - headers already sent by (output started at /home/mhd-01/www.giorgionecalcio.it/htdocs/wp-content/plugins/ArticoliCategoria.php:2) in /home/mhd-01/www.giorgionecalcio.it/htdocs/wp-includes/pluggable.php on line 381

    Warning: Cannot modify header information - headers already sent by (output started at /home/mhd-01/www.giorgionecalcio.it/htdocs/wp-content/plugins/ArticoliCategoria.php:2) in /home/mhd-01/www.giorgionecalcio.it/htdocs/wp-includes/pluggable.php on line 382

    Warning: Cannot modify header information - headers already sent by (output started at /home/mhd-01/www.giorgionecalcio.it/htdocs/wp-content/plugins/ArticoliCategoria.php:2) in /home/mhd-01/www.giorgionecalcio.it/htdocs/wp-includes/pluggable.php on line 383

    Warning: Cannot modify header information - headers already sent by (output started at /home/mhd-01/www.giorgionecalcio.it/htdocs/wp-content/plugins/ArticoliCategoria.php:2) in /home/mhd-01/www.giorgionecalcio.it/htdocs/wp-includes/pluggable.php on line 384

    Warning: Cannot modify header information - headers already sent by (output started at /home/mhd-01/www.giorgionecalcio.it/htdocs/wp-content/plugins/ArticoliCategoria.php:2) in /home/mhd-01/www.giorgionecalcio.it/htdocs/wp-includes/pluggable.php on line 331

    Qualche suggerimento??
    ciao!

  14. Stefano wrote:

    Ciao Maurizio,
    ho rilasciato la versione 1.2 del tuo plugin compatibile con WP 2.3.x. Ecco il link: http://www.astronomia.com/temp/posts-in-category.zip

    A presto!

  15. Izzyweb.it wrote:

    Ottimo plugin lo installo subito
    Grazie

  16. naisioxerloro wrote:

    Hi.
    Good design, who make it?

  17. Silvana wrote:

    grazie Maurizio per il plugin, provo lo stesso a farti la domanda anche se mi sembra non ti piaccia rispondere..chissà magari per una valtellinese..
    nella lista “concorsi” che mi crea, non riesco a capire perchè alla fine, mi aggiunge un link ad una pagina del sito?? ho guardato o riguardato il codice ma mi sfugge qualcosa?
    grazie

  18. Dominic Desbiens wrote:

    It work on Wordpress 2.5 with modification by Stefano, thanks. But is there an optimisation or changes required for Wordpress 2.5 ??

    Es trabajar en Wordpress con 2,5 modificación de Stefano, gracias. Pero hay una optimización o los cambios necesarios para Wordpress 2,5? Responder en Inglés, por favor.

Add your comment:

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

10 Trackbacks / Pings to “Plugin: Posts in category 1.1”

  1. WordPress Italy » Blog Archive » Plugin WordPress: Posts in category 1.0

    [...] Posts in category 1.0 è un plugin “figlio” del nostro Forum. L’autore infatti ha messo in pratica e approfondito i consigli ricevuti in una discussione e ne ha ricavato un plugin a nostro avviso molto utile: permette infatti di mostrare un elenco di link ad articoli appartenenti ad una o più categorie. Il plugin è anche personalizzabile secondo alcuni parametri definibili dall’utente. Complimenti Petro! [...]

  2. SpazioDigitale (blog) » Blog Archive » blogmarks for 12-05-2006

    [...] Plugin: Posts in category 1.0 The plugin shows a customizable list of links to the posts published in the specified categories (also multiple ones). (tags: blog wordpress plugin categories WP) [...]

  3. About SEO Blog

    [...] SEO Blog is WordPress 1.5.2 Theme: Almost Spring 1.2 Plugins: Bot Check 1.1, Category Order 1.0, Jerome’s Keywords 1.8.1, Search All 0.3, Popularity Contest 1.2b [...]

  4. Search Executive Officer - SEO Tips » Blog Archive » Optimize Wordpress Blog for SEO

    [...] Link between posts having the same topic or subject “If one is reading an article focused on a specific subject, probably he’s interested in reading other posts about the same, or at least similar, topic”. Do you agree with this sentence? Believe me, search engines do.All you have to do, is to facilitate the chances of jumping between articles. Link every post with others by the same category (maybe my plugin can help you), and also link posts that are in some way related each other, even despite the category information (try Related Entries plugin). [...]

  5. List of plug-ins that I used/found interesting at Webmasters’ notes

    [...] plugin-posts-in-category/” title=”Visit plugin homepage”>Posts in Category [...]

  6. WordPress Blog Gratis » Blog Archive » Wordpress e Mod Rewrite per Seo e ottimizzazione per i motori di ricerca

    [...] “Se uno sta leggendo un articolo che tratta uno specifico argomento, egli probabilmente è interessato a leggere altri articoli che trattano argomenti simili, se non proprio lo stesso”. Sei d’accordo con questa affermazione? Ci credono anche i motori di ricerca. Tutto quello che devi fare è facilitare le opportunità di saltare da un articolo all’altro. Collega ogni post con altri appartenenti alla medesima categoria (questo plugin) può aiutarti), ma collega anche post che sono in qualche modo correlati gli uni agli altri, pur senza essere necessariamente nella stessa categoria (prova questo plugin: Related Entries). [...]

  7. WP Plugins DB » Blog Archive » Posts in Category

    [...] Visit [...]

  8. WordPress by VostroPortale.com » Ottimizzare WordPress per i motori di ricerca

    [...] Possiamo inserire dei plugin aggiuntivi per ottimizzare wordpress ulteriormente come per esempio questo plugin che crea collementi con altri post appartenenti alla stessa categoria, oppure Related Entries [...]

  9. Wordpress, alcuni accorgimenti lato SEO

    [...] Un altro utile accorgimento è senz’altro quello di linkare tra di loro articoli che parlano dello stesso argomento, di solito gli articoli di una stessa categoria. Ci può venire incontro il plugin posts in category. Una volta installato e attivato il plugin, seguiamo le istruzioni nel codice sorgente del plugin stesso per utilizzarlo nel modo che desideriamo. Esempio: se vogliamo inserire in un articolo i link agli articoli della stessa categoria (escluso l’articolo che stiamo visualizzando) basterà inserire nel file single.php del tema che stiamo utilizzando il seguente codice: [...]

  10. SEO Tips For Wordpress « Geek Notes

    [...] All you have to do, is to facilitate the chances of jumping between articles. Link every post with others by the same category (maybe my plugin can help you), and also link posts that are in some way related each other, even despite the category information (try Related Entries plugin). [...]