go41

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

von Joern am 13. Jun. 2010 | Keine Kommentare

imho the way to add the sort code for a custom field with the name ‚YOUR-CUSTOMFIELD-NAME‘ should work like this for each section
Code:

<?php query_posts('showposts=20&cat=26&orderby=meta_value&meta_key=YOUR-CUSTOMFIELD-NAME&order=DESC'); $i = 1; ?>

the word YOUR-CUSTOMFIELD-NAME has to be the name of the custom field to sort by the values of this field, here the name of your price or value field.
____________________
you find me on Google+, Twitter and Facebook

(von: master)

Hier noch 5 weitere Ergebnisse dieses Threads:

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

26. Mai. 2010 (von: adamwork)

Hi allI'm using wordpress to act as a CMS for listing products. See development so far here:http://www.concept-ents.com/hire/disco- ... hting-hireThe price column, on the left hand side, is generated by a custom field "Price"How can I set it, so that each…

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 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: