Posts per Cat
Šta je Posts per Cat?
Posts per Cat je dodatak za WordPress platformu za blogovanje koji omogućava listanje poslednjih N naslova za sve ili samo za kategorije najvišeg nivoa na blogu. Naslove po kategorijama grupiše u kućice i slaže ih u dve kolone.
Odakle da preuzmem Posts per Cat?
Posts per Cat u verziji 0.0.12 možete preuzeti odavde: Posts-Per-Cat 0.0.12 (45) ili iz Vordpres riznice na adresi http://wordpress.org/extend/plugins/posts-per-cat/.
Ovaj dodatak nastao je kao rezultat davanja primera polaznicima druge generacije Škole veb novinarstva o izmeni i unapređivanju naslovne stranice bloga.
Kako se instalira?
Preuzetu datoteku raspakujte pomoću arhivera (preporučujem program 7zip), a potom dobijeni direktorijum posts-per-cat/ pomoću FTP klijenta (preporučujem program FileZilla) postavite na server u direktorijum wp-content/plugins/ Vaše Vordpres instalacije.
Ako koristite Vordpres 2.9 ili noviji, instalaciju obavite sledeći donje video uputstvo.
Podešavanja dodatka
Kao što ste u gornjem video uputstvu mogli da vidite, podešavanja dodatka Posts per Cat vrše se u odeljku Kontrolne table do koga se dolazi preko menija Podešavanja → Članci po kategorijama.

Pozicija dodatka Posts per Cat u meniju Podešavanja
Opcije za podešavanja podeljene su u četiri sekcije — Kutije, Opcije kategorija, Postavke članaka i Opciono.
Kutije
U odeljku Kutije određuje se minimalna visina kućice koja sadrži izlistane naslove članaka, kao i broj kolona po redu. Podrazumevano se prikazuju dve kolone (kućice) po redu, dok se opciono može izabrati prikaz jedne kućice po redu, razvučene celom širinom članka.
Opcije kategorija
U ovom odeljku mogu se odrediti kategorije koje će jedino biti prikazane, odn. sakrivene, da li će se prikazivati samo kategorije najvišeg nivoa, te po čemu će se vršiti sortiranje kućica (po ID broju ili nazivu kategorije).
Postavke članaka
Karakteristike izlistanih članaka određuju se u sekciji Postavke članaka. Može se odrediti broj članaka čiji će naslovi biti izlistani, opciona dužina naslova u karakterima sa opcijom za aktiviranje skraćivanja dugačkih naslova. Ako na blogu postoje istaknuti članci (eng. Sticky posts), oni se mogu sakriti iz listanja aktiviranjem odgovarajuće opcije.
Ovde se takođe može izabrati opciono prikazivanje sažetaka članaka sa sve ili samo prvi članak u kućici. Takođe se može odrediti dužina sažetka u karakterima.
Opciono
Ukoliko nije uključena opcija za primenu stila nabrajanja koji dolazi uz Posts-per-Cat, biće upotrebljen podrazumevani stil teme koji u neki mtemama može izgledati loše. Da bi rešili takav problem uključite opciju za primenu PPC stilova u ovoj sekciji.
Kako se koristi?
Za upotrebu, t.j. prikaz kućica sa kategorijama na blogu, neophodno je dodati jednu liniju kôda za pozivanje Posts per Cat funkcije za štampanje sadržaja.
Jednostavno u šablon teme treba umetnuti sledeći kôd na mesto gde se želi dobiti spisak naslova po kategorijama:
<?php do_action("ppc"); ?>
Preporučujem da ovaj kôd umetnete u šablon glavnog indeksa (datoteka indeks.php) iza paginacije:
<?php endif; ?>
<?php do_action("ppc"); ?>
</div>
Kako izgleda?
Kada ste dodatak instalirali, podesili ga i dodali na željeno mesto, dobićete nešto nalik na sledeće dve slike.
Karakteristike
- podesiv broj naslova po kategoriji
- izbor listanja ili zaobilaženja naslova iz određenih kategorija
- izbor prikaza naslova iz kategorija najvišeg nivoa
- izbor poretka kategorija (ID ili naziv)
- određivanje dužine naslova i sažetka članka
- određivanje minimalne visine kućice za kategoriju
- prikaz dve kolone po redu ili samo jedne kolone celom širinom
- koristi sopstveni CSS koji se izmenom može prilagoditi potrebama korisnika
- preveden na srpski jezik (podrazumevani jezik je engleski)
- daje validan XHTML 1.1 kôd
- objavljen pod GNU GPLv3 licencom
Urađeno
- dodata opcija za prikaz dve kolone po redu (podrazumevano) ili samo jedne kolone celom širinom (opciono) 0.0.10 (07.01.2010)
- ceo naziv članka kao veza do članka, otklonjena greška koja proizvodi nevalidan XHTML kôd 0.0.9 (09.10.2009)
- dodat izbor kategorija koje će biti, odn. neće biti izlistane, prikaz sažetka za prvi ili sve članke u kategoriji, skraćivanje naslova i sažetka zapisa na željenu dužinu, određivanje minimalne visine kućice kategorije, permalinkovi za kategorije i članke 0.0.8 (26.09.2009)
- dodat action hook ppc, dodatak objavljen u Vordpres riznici 0.0.7 (04.03.2009)
- ispravljena greška za CSS URI na podstranama 0.0.6 (03.03.2009)
- dodata opcija za upotrebu pripadajućeg CSS stila za liste 0.0.5 (20.02.2009)
- sređen problem sa pozicioniranjem i listama 0.0.4 (20.02.2009)
- objavljeno probno izdanje 0.0.3 (16.02.2009)










68 comments to “Posts per Cat”
February 20th, 2009 at 09:59
Ćao,
Radi ali ne izgleda trenutno baš najbolje. Pogledaj webnovinar.org
Pozdrav
February 20th, 2009 at 10:24
@ljubiša: U redu, vidim, i znam u čemu je problem — izostavio sam stilove za listu iz pripadajućeg CSS-a, oslaajući se na to da blog već ima definisan odgovarajući stil za liste (poput moje teme 5Years). Biće ispravka danas popodne.
February 20th, 2009 at 10:43
@Aleksandar: Hvala puno
February 20th, 2009 at 16:58
@ljubiša: Verzija 0.0.4 ispravlja uočene nedostatke (stilovi liste i pozicioniranje kućčica), i dostupna je za preuzimanje.
Dodatak: Veoma brzo sam pustio i verziju 0.0.5 koja od noviteta ima korišćenje pripadajućeg CSS stila za listu. Ukoliko ova opcija nije uključena, koristiće se stil liste iz teme (što, obično, nije baš vizuelno ugodno).
February 20th, 2009 at 18:00
@Aleksandar: Odlično radi! Hvala ti
March 4th, 2009 at 21:50
[...] Posts per Cat [...]
March 4th, 2009 at 22:36
[...] Posts per Cat [...]
July 5th, 2009 at 17:39
Hvala ti za ovaj plugin, kao i za Time Machine!
))
September 23rd, 2009 at 12:18
Nice tool but i’d like to be able to select one root category so I can display only sub-cat of it.
I am working on a freeware/shareware blog with posts with category “programs”, “lessons”, “tricks”, “news”.
“programs” will have sub-categories “disk, graphism, music, internet, anti-virus…” and would like PPC to display index page only for all what is inside Programs.
September 26th, 2009 at 11:20
@dodfr: You can do that with latest version 0.0.8 by typing category ID’s of „programs“, „lessons“, „tricks“ and „news“ in field Include category and disable option Only top level categories.
September 26th, 2009 at 15:01
Super je ovo, moracu da ga probam negde…
October 9th, 2009 at 23:27
[...] Posts per Cat [...]
November 9th, 2009 at 02:03
Gde se može naći prevod na srpski za ovaj dodatak
November 9th, 2009 at 08:24
@Nolle: Srpski jezik je sastavni deo dodatka. Potrebno je da Vordpres bude lokalizovan na srpski jezik i dodatak će automatski biti lokalizovan.
Ako koristite englesku verziju Vordpresa, potrebno je da u wp-config.php za WPLANG postavi lokalitet sr_RS, ovako:
define ('WPLANG', 'sr_RS');November 10th, 2009 at 21:35
Any chance of getting this plugin in English?
November 10th, 2009 at 23:43
@Renowned Media: English is default language for Posts-per-Cat. Check out WP repo.
November 16th, 2009 at 13:45
I would like to get a list o post but just one category
is it possible?
it’s like to put a parameter on where indicate the category ID
November 16th, 2009 at 14:22
@Vicenç: Yes, that is possible. Just enter category ID in field “Include category”. I hope that you use Posts-per-Cat 0.0.9?
November 26th, 2009 at 18:04
I really like your plugin, I’m using it on my home page. I am also displaying two post excerpts via the sticky post function. I was wondering if it would be possible to filter the output of your plugin so that there is an option to not include sticky posts?
Thanks in advance for you help.
November 26th, 2009 at 18:37
@Todd: That can be implemented, but do you use featured category, or custom field for making post sticky?
If you use custom field, U can replace line 230 in wp-postspercat.php
$clanci = get_posts('numberposts='.$ppc_posts.'&order=DSC&orderby=date&category='.$kat->cat_ID);with this:
$clanci = get_posts('numberposts='.$ppc_posts.'&order=DSC&orderby=date&category='.$kat->cat_ID.'&meta_key=sticky&meta_value=0');This will work (I hope) only if you use custom field with name “sticky” to set post sticky.
November 26th, 2009 at 18:51
I’m using query_posts for the loop … along the lines of this example from smashingmagazine.com
$sticky, 'caller_get_posts' => 1 ) );
06
07 if (have_posts()) :
08 while (have_posts()) : the_post();
09 the_title();
10 the_excerpt();
11 endwhile;
12 endif;
13
14 ?>
I have that display the first two sticky posts, then called your plugin for the post by category.
I think I found the code I need in wordpress codex to exclude the sticky posts ( ‘post__not_in’ => $sticky,) … but I’m not comfortable enough trying to edit plugin files to try to figure out on my own where to put it.
Thanks in advance,
Todd
November 26th, 2009 at 19:10
@Todd: OK, tell me how you define sticky post in WP admin panel? Do you set some custom field (an if use, which is a name of that field), or use some plugin?
PPC does not use query_post() but get_posts() call, so Smashing Magazine example need to be added and tweaked manualy.
November 26th, 2009 at 19:23
@Aleksandar: Hi … actually I’m just using the checkbox next to “Visibility” in the WordPress Publish box to make the posts I want on the home page “sticky”.
I have no problems displaying the sticky posts, or the output from your plugin … it works great. The only thing I was hoping I might be able to do, is to find a relatively “easy” way to exclude those two posts (which will always be the only 2 defined as “sticky” at any time) from the post by category output … so that I don’t have multiple links to the same post showing on my home page.
If it’s a complicated fix, than it really isn’t a big deal, I can live with it like it is.
Again, thank you for the plugin, it was exactly what I was looking for … saved me from having to try to figure out how to code php/css to display my posts in that format.
November 26th, 2009 at 20:17
@Todd: OK, then, here is fast fix. Replace line 230 in wp-postspercat.php
$clanci = get_posts('numberposts='.$ppc_posts.'&order=DSC&orderby=date&category='.$kat->cat_ID);with this code:
$clanci = get_posts(array('post__not_in' => get_option("sticky_posts"),
'numberposts' => $ppc_posts,
'order' => "DSC",
'orderby' => "date",
'category' => $kat->cat_ID
));
I’ll add a new option on Posts-per-Cat settings page to exclude sticky posts in next release.
November 26th, 2009 at 20:50
That worked perfect! Thank you so much.
November 28th, 2009 at 13:33
@Aleksandar:
Tako mi i stoji
November 28th, 2009 at 13:52
@Nolle: Ako si instsalirao dodatak preko ugrađene funkcije u Vordpresu, onda bi trebalo da koristi srpski jezik. Koja je adresa bloga gde to ne radi?
December 1st, 2009 at 19:57
Dear Author,
I am using your plugin, i like it very much… thanks a lot.
I read your instructions with the help of google translator.
It would be a great pleasure if you could tell me how to make it into a single column.
thanking you with anticipation.
December 1st, 2009 at 22:44
@Zolengthe: Open file posts-per-cat/ppc.css to edit (you can use plugins editor from admin panel) and find line 21 (part of #ppc-box .ppc-box selector). Then add next two lines before ending }
December 16th, 2009 at 15:02
I have been looking for something like this for along time
Thank you very much! I hope it’s gonna work nice with wordpress 2.9
and thumbnails! Coz I love it!
quick dummy question sorry
I have ticked the box to apply your style sheet as it looks cleaner.
Is there a way to change the style of the category name when listed so that people can easily dissociate categories and post titles. would make things much clearer, especially when listing many categories!
if you check the homepage
http://tattoo.yoso.eu you’ll see what I mean
Also it would be great if the bottom line of each cells where lined up with the longest one next to it! Just cleaner
Anyway! Many thanks to you
Really enjoy to have found your plugin
December 16th, 2009 at 15:31
@yoso: In fact, PPC CSS provides only graphical styles, not typography, so you can tweak it by adding styles .ppc h3 a (category name) and .ppc ul li a (post titles) to ppc-list.css, or by doing that in template’s CSS.
It’s not possible to calculate height of column, so you can set Minimal height of box on PPC settings page.
Thumbnails and option to display PPC in one or two columns is in my TODO. And there is no reason to not work on 2.9 as we expect (tested with 2.9 Beta2 and works as charm)
December 16th, 2009 at 18:38
Thank you
I found the height of boxes
Am lost with style sheet 
Many thanks!
Will have to study
December 17th, 2009 at 05:23
sorry for being stupid
If you have the time
If I want the header of cats to be same as headers on the right hand side? Any chance to get the exact code?
http://tattoo.yoso.eu/
many thanks
December 17th, 2009 at 09:02
finally hacked it thanks
god it was simple
December 27th, 2009 at 18:03
@Aleksandar:
Thank you so much..
January 7th, 2010 at 10:16
Dear Aleksandar,
Thank you for helping me, now my blog looks very beautiful, hmmmmmm!
i would like to ask one more favor from you.
Now, I display 5 headlines under every Catagory. What i want to know is MORE NEWS/HEADLINES under this (one particular) category.
Example: I display 5 headlines under NORTHEAST INDIA.
After those 5 headlines, i want More News under NORTHEAST INDIA to be appear, so that one can browse the whole news under that category.
thanks
January 7th, 2010 at 11:24
@Zolengthe: That is exactly what links on category title does. I think that double linking is not “a must have”… or, maybe I can add option to toggle “More News under CATEGORY-NAME”…
February 6th, 2010 at 13:35
aco,
da li je moguce da se uradi sledece(ikako)?
znam da se moze odrediti broj postova(clanaka) koji ce biti izlistani po kategoriji,a da li je moguce da npr. podesim da upisem 5 postova po kategoriji,s tim da na kraju stoji mogucnost tipa: more,next,jos,…kojim se otvaraju svi postovi za tu kategoriju.ovo bi bilo dobro za moj sajt http://www.majstoranadji.com/ jer su kategorije nejednako popunjene i glupo bi bilo da se u jednoj prikazu npr 15 postova ,a u drugoj 3,jer bi bilo asimetricno mnogo.nadam se da si shvatio sta je pisac hteo..
poz
danko
February 6th, 2010 at 14:28
@danko: opcija prikaza izdvojene veze „još iz kategorije“ nalazi se u eksperimentalnom (razvojnom) izdanju 0.0.11 koje se može preuzeti sa stranice dodatka na Vordpres kodeksu (veza na početku članka).
February 14th, 2010 at 18:42
Dodatak radi odlicno. Video instalacije je koristan i pregledan. Hvala ti.
April 23rd, 2010 at 20:37
sve mi radi ok i ako koristim razvojnu verziju.nego,da li i kako da prikazem samo odredjene postove na pocetnoj strani(znam da mogu da se izostave) ali tako kad kliknem da prikazem ostale ni jedan ne bude izostavljen vec da vidim sve.
npr.imam upisano 10 postova u jednoj kategoriji,izabrao sam da se prikaze 7 s tim da kad kliknem pogledaj ostale upise vidim svih 10.to sve radi ali kako da medju prikazanih 7 izaberem koje ja hocu i po redu koji hocu(sada mi se prikazuju po redosledu upisa – najnoviji je prvi na listi
April 23rd, 2010 at 21:40
@danko: Mogao bi recimo da koristiš „Prilagođena polja“, tako da dodaš recimo promenljivu moj_poredak i onda upišeš brojeve za njenu vrednost u onim člancima koje želiš da prikažeš, a onda da radiš sortiranje po tom prilagođenom polju. Možeš početi recimo odavde.
May 10th, 2010 at 12:03
This plugin worked very nicely until just yesterday. It is new creating an error on the homepage;
Fatal error: Call to undefined function mb_strlen() in
wp-content\plugins\posts-per-cat\wp-postspercat.php on line 275
Can someone help with this. Thank you
May 10th, 2010 at 14:40
@CSS: Get fresh version 0.0.11.
May 18th, 2010 at 10:41
Dear Aleksandar,
This plugin is great, but I have an issue, using the one column option. On Internet Explorer, it does not seem to work.
Do you know what’s wrong ? Many thanks for this very usefull tool, regards, Aey
May 18th, 2010 at 15:14
@Aey: Which IE version you use? I tested PPC with IE8 and all works great.
May 18th, 2010 at 18:48
Dear Aleksandar, thank you very much for your prompt answer. I have reproduced this issue on several versions of Internet Explorer : ie7, ie8 both on Windows XP. You can see that by yourself using online browser tools for webmasters. Otherwise, I can send you a screenshot if needed.
Regards, Aey
May 18th, 2010 at 20:07
@Aey: OK, I tested 0.0.11 in IE8 and works OK, but IE6 strech content in width. Not tested with IE7.
Please update PPC to version 0.0.12 and try again.
May 19th, 2010 at 10:14
Dear Aleksandar, this upgrade did the trick ! It is now almost perfect under IE now. There is still a slight thing about “li” looking, but I think it’s more related to a conflict between ppc css and theme css.
Thank you so much for your help !
May 25th, 2010 at 01:20
Hello,
Many Thanks for this great plugin.
If you have time though, I’m needing help.
I seem to have the opposite problem from others : cats will not be diplayed in 2 columns and there are no boxes, only lists with bullets (those from my template). I may be wrong but maybe the puglin css is not recognised in my blog.
Do you (or anyone) have a suggestion ?
Thanks !
May 25th, 2010 at 05:38
@pep: Can you please post a URL to your blog with active PPC, so I can see that bug?
May 25th, 2010 at 06:49
Many thanks for taking the time.
Here’s the blog : http://www.enfants-spectacle.com/
I have changed back to full title but when I select ‘shorten’ the display is the same as far as the rows and boxes are concerned (but the title does shorten).
May 25th, 2010 at 14:29
@pep: Please, check is there a real file http://www.enfants-spectacle.com/wp-content/plugins/posts-per-cat/ppc.css because I got 404 Error page. That give us two solutions:
You can edit default theme, add
<?php do_action("ppc"); ?>in index.php and check theme preview. If you get two columns, then problem is in theme you use.May 25th, 2010 at 16:03
Thanks again.
There is a real ppc.css in the folder (i downloaded it and checked it was not empty).
I tried to add the php code you mentioned in the index.php of my template, did not work either (and I tried in the page.php as well since I use the plugin in a page, did not work either).
It’s weird…
I have no idea what to do.
May 25th, 2010 at 16:55
@pep: No, no, I mean to check default WP theme by adding that PHP code in default theme (click here to open index.php for default WP theme). If PPC works OK in default theme, feel free to send me theme you use so I can fin a bug.
May 26th, 2010 at 22:11
Hi Alexander, thank you so much.
I tired that : the code in the default theme’s index.php.
It did not work.
So I begin wondering if there isn’t a conflict between several plugins…If I find, I’ll let you know.
Thanks any how !
May 27th, 2010 at 06:00
@pep: OK, I found problem. You installed WP in subdeirectory WordPress. Now I added individual installation path for CSS in version 0.0.13. Please upgrade.
May 27th, 2010 at 20:37
Whoooaaaooo ! You’re the best ! It works !
Thank you soooo much !
By the way, if you plan to have it translated into French someday, I’d be glad to help. Contact me on my email.
May 27th, 2010 at 21:03
@pep: Done!
July 6th, 2010 at 21:20
Hello, do you have the English version one? I think this might the exact tutorial I’ve been looking for. I hope you have it in english, thanks in advance!
July 9th, 2010 at 01:12
is it possible to add a post date? Nice work. Thanks.
July 9th, 2010 at 07:35
@Yurckk: No, right now I don’t have full tutorial in English. I hope Google translate can help, anyhow?
@bouba: When you hover title link, tooltip display date and time of post publishing. Do you think on that, or some other functionality?
July 9th, 2010 at 16:47
@Aleksandar:
Ah, yes, very nice.
I wondered if the date could be inserted right next to the actual post.
Thanks again.
July 9th, 2010 at 17:52
@bouba: That can be added as option in Widget control… Just give me some sugestions which options to add (only date after title, option to put date before or after title, etc)?
July 9th, 2010 at 18:24
@Aleksandar:
Thanks a lot for answering.
The options would be to have the date (or time, or both) appear at the end of the post title (or at the beginning), as in:
“this is the post” – June 10, 2010
I hope this makes sense.
July 13th, 2010 at 16:39
@bouba:
I’ve used the following to display the date:
How would I format the output?
July 15th, 2010 at 14:52
@bouba: Use this hack:
echo mysql2date('j M Y', $clanak->post_date);just use proper PHP date format instead of ‘j M Y’.
July 18th, 2010 at 13:38
@Aleksandar:
Fnatastic! Supach! Thanks very much.