Can you clarify what isn’t working? Your code looks fine at first glance. Are you passing these arguments to a new query:
$args = array(
'orderby' => 'meta_value_num',
'meta_key' => '_ss',
'order' => DESC
);
$new_query = new WP_Query( $args );
if ( $new_query->have_posts() ) :
while ( $new_query->have_posts() ) : $new_query->the_post();
...loop code...
endwhile;
endif;
Hi @qsz,
You arguments look fine.
Some useful doc on the order by (including a meta example) : http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
Hope this helps
Thread Starter
qsz
(@qsz)
Thanks, but I’m beginner and cannot find the file in Customizr theme which I should change.
Is it index.php?
If yes, should I paste the code before?
<?php do_action ('__before_loop');##hooks the heading of the list of post : archive, search... ?>
If not, can you tell which file I should edit?
You need to edit the functions.php file.
You could use the following example of code :
http://sterlinghamilton.com/order-meta-values-wordpress/
This requires some advanced php skills tough, I would recommend to ask the help of a proficient developer to implement this.