• I’m trying to fix our team page with all our players but cant solve the problem with sorting with more than one argument. Cant figure out what i’m doing wrong…

    Both arguments work fine by them selves, but just the first one works when I use the code below. What i want is – first sort on category (A,B,C,D) and second sort on number. In other words – All the people on category A will be A12349 and not random like A39214….

    Please se the template below with bold on the code thats failing.

    <?php
    /*
    Template Name: Users
    */

    // Get all users order by category A,B,C,D,E and number
    $users = get_users(array(
    ‘role’ => ”,
    ‘orderby’ => ‘meta_value’,
    ‘meta_key’ => ‘category’,
    ‘order’ => ‘ASC’,
    ‘meta_query’ => array(
    array(
    ‘orderby’ => ‘meta_value’,
    ‘meta_key’ => ‘nummer’,
    ‘order’ => ‘ASC’,
    ))));

    // Remove user role by add role between ‘role goes here’
    foreach($allUsers as $currentUser)
    {
    if(!in_array( ”, $currentUser->roles ))
    {
    $users[] = $currentUser;
    }
    }

    ?>

    <?php get_header(); ?>
    <div class=”row”>
    <header class=”page-heading block-background block-inner”>
    <h3><?php wp_title(”); ?></h3>
    <div class=”minimize”></div>
    </header><!– .page-heading –>

    <div class=”main-content block-background column col12″>
    <div class=”block-inner”>
    <article class=”entry-post”>
    <header class=”entry-header”>
    <h2 class=”entry-title”><?php _e(”);?></h2>

    <?php

    foreach($users as $user)
    {
    ?>

    <div class=”author”>
    <div class=”comment-avatar”>
    <?php echo get_avatar( $user->user_email, ’92’ ); ?>
    </div>

    <div class=”authorInfo”>

    <h1 class=”comment-author”><?php echo $user->display_name; ?> #<?php echo get_user_meta($user->ID, ‘nummer’, true); ?></h1>
    <p class=”authorDescription”><?php echo get_user_meta($user->ID, ‘position’, true); ?> | <?php echo get_user_meta($user->ID, ‘land’, true); ?> cm | <?php echo get_user_meta($user->ID, ‘vikt’, true); ?> kg | Födelseår: <?php echo get_user_meta($user->ID, ‘far’, true); ?></p>

    </p>
    </div>
    </div>

    <?php
    }
    ?>
    </section>

    </header>
    </article>

    </div><!– .block-inner –>
    </div><!– .main-content –>

    </div>
    <?php get_footer(); ?>

The topic ‘Multiple meta_value sort help…’ is closed to new replies.