go41

How to get posts to list in order, depending on value of custom field

von Joern am 26. Mai. 2010 | Keine Kommentare

Hi all
I’m using wordpress to act as a CMS for listing products. See development so far here:
http://www.concept-ents.com/hire/disco- … hting-hire
The price column, on the left hand side, is generated by a custom field "Price"
How can I set it, so that each of the posts under the categories, appear in price order?
Many thanks for any suggestions.
Adam

(von: adamwork)

Hier noch 5 weitere Ergebnisse dieses Threads:

Re: How to get posts to list in order, depending on value of custom field :: Reply by Joern

30. Mai. 2010 (von: Joern)

first I should know if you use a custom category.php for your categories?Most themes just have an archive.php for any kind of archive, be it category, date or tag etc.Using a template for categories only you need something like a…

Re: How to get posts to list in order, depending on value of custom field :: Reply by adamwork

13. Jun. 2010 (von: adamwork)

Hi JoernWhat I have done, is to create a page template, for example this page here:http://www.concept-ents.com/hire/disco- ... pment-hire has a template.Then for each section, I have this in my code:Code:<?php if (have_posts()) : ?>    ... Weiterlesen →

Re: How to get posts to list in order, depending on value of custom field :: Reply by master

13. Jun. 2010 (von: master)

imho the way to add the sort code for a custom field with the name 'YOUR-CUSTOMFIELD-NAME' should work like this for each sectionCode:<?php query_posts('showposts=20&cat=26&orderby=meta_value&meta_key=YOUR-CUSTOMFIELD-NAME&order=DESC... Weiterlesen →

Re: How to get posts to list in order, depending on value of custom field :: Reply by adamwork

13. Jun. 2010 (von: adamwork)

Hi masteradmin[/code]Thanks for your response... I've tried updating the code, so it looks like this:Code:<?php if (have_posts()) : ?><?php query_posts('showposts=20&cat=26&orderby=meta_value&meta_key=Price&order=DESC'); $i = 1... Weiterlesen →

Re: How to get posts to list in order, depending on value of custom field :: Reply by adamwork

13. Jun. 2010 (von: adamwork)

RESULT! I changed it to:Code:<?php if (have_posts()) : ?><?php query_posts('showposts=20&cat=26&orderby=meta_value&meta_key=Price&order=ASC'); $i = 1; ?><?php while (have_posts()) : the_post(); ?>    And it w... Weiterlesen →

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: