go41

Re: Placing Other Categories in the Featured-Section :: Reply by Joern

von Joern am 27. Jan. 2011 | Keine Kommentare

in Arthemia the query for category Headline is like this:

Code:

<?php query_posts("showposts=1&category_name=Headline"); ?>

If you know the ID of this category (here as sample ID=4) you could use:

Code:

<?php query_posts("showposts=1&cat=4"); ?>

Coming to Featured section, normally like this:

Code:

<?php query_posts("showposts=4&category_name=Featured"); $i = 1; ?>

this you could replace with the ID (here 6) instead of category name:

Code:

<?php query_posts("showposts=4&cat=6"); $i = 1; ?>

It might be possible you think category_name refers to the display name of the category?

This is wrong, actually you should use the category slug in here.
In WordPress Support Forum http://codex.wordpress.org/Function_Ref … uery_posts you can read under Category Parameters:

category_name (string) – use category slug (NOT name)
Personally I would use the ID thing "cat (int) – use category id" like

query_posts( ‚cat=4‘ );
to get exactly what I want, regardless of name or slug as they might be different
Did it help?
____________________
you find me on Google+, Twitter and Facebook

(von: Joern)

Hier noch 3 weitere Ergebnisse dieses Threads:

Placing Other Categories in the Featured-Section

26. Jan. 2011 (von: raf_79)

Please forgive me if this has already been addressed in the forum.By following instructions here in the forum, I've been able to get 2 featured sections functioning correctly side-by-side on my site. However, I would like to be able to…

Re: Placing Other Categories in the Featured-Section :: Reply by raf_79

27. Jan. 2011 (von: raf_79)

Yes it did. Thank you! What would I have to do additionally to select which posts to display in a category as opposed to the most recent post as it displays now? Weiterlesen →

Re: Placing Other Categories in the Featured-Section :: Reply by Joern

28. Jan. 2011 (von: Joern)

check the WordPress Support Forum link I gave you above.you could query by another parameter like author, tag etc, you could just query one or two posts exactly (Post & Page Parameters)you could change the sort order (Order & Orderby…

Autor:

Du findest mich auch auf Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.

weitere forum Beiträge: