The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Sort post by custom field alphabetically (1 post)

  1. romuloctba
    Posted 3 years ago #

    Hi ther everybody.
    I have searched all arround for a awnser to this. Even thoug i found some clues using another kind of loop structure, directly from db i didn't get it

    I have this code:

    <?php $argsvs = array(
           	      		'post_type' => 'imovel-para-venda',
           	      		'meta_key' => 'wpcf-imovel-preco',
           	      		'posts_per_page' => 0,
           	      		 'oderby' => 'meta_value',
           	      		 'order' => 'DESC'
    $loop = new WP_Query( $argsvs );
    while ( $loop->have_posts() ) : $loop->the_post();

    and so on
    the thing is that the custom field wpcf-imovel-preco was created using the plugin Types, and it is a text field. Usually, it is used to put numbers, but sometimes filled with words too.

    Anyone could help me find the way to order my loop by that custom field? Alphabetically, i think?

Topic Closed

This topic has been closed to new replies.

About this Topic