• Resolved odedt

    (@odedt)


    Hi,

    I try to order by category, but it doesn’t seem to work. I can see the order in back, but in the archive page I dont see the order. Do I need to add something special in the query?

    this is my query:

    $args = array(

        ‘post_status’ => ‘publish’,

        ‘post_per_page’ => 12,

    ? ? ‘post_type’ => ‘product’,

    );

    $products = New WP_Query($args);

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Aslam Doctor

    (@aslamdoctor)

    Hi @odedt ,

    Update your $args to something like this

    $category_id = 123; // change this to your category id
    $meta_key = 'rwpp_sortorder_' . $category_id;
    
    $args = array(
        'post_status' => 'publish',
        'post_per_page' => 12,
        'post_type' => 'product',
        'meta_key' => $meta_key,
        'orderby' => 'meta_value_num menu_order title',
        'order' => 'ASC',
    );

    Let me know if that works,

    Kind regards,
    Aslam

    Thread Starter odedt

    (@odedt)

    Yes, it work! thanks

    Plugin Author Aslam Doctor

    (@aslamdoctor)

    Great.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Products don’t get ordered’ is closed to new replies.