C
C
CrewCut2016-03-28 14:30:05
WordPress
CrewCut, 2016-03-28 14:30:05

How to make posts display order according to custom field in Wordpress?

There are posts that have an arbitrary field - a list of checkboxes from ACF. There are sizes 40, 42, 44, etc.
There is a cookie that is set to match a checkbox, like "56". You must first display posts where the checkbox 56 is checked, then 58/60, then all the rest in random order. I can't figure out how to do this at all.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Kozlov, 2016-03-28
@trampick

query_posts(
    array(
            'order'     => 'ASC',
            'meta_key' => 'your_meta_key',
            'orderby'   => 'meta_value_num'
    )
);

instead of your_meta_key - insert your field name

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question