Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created a sortable bar where with different options of orderby queries, like Random, Most Recent and others. The code looks like this:

$orderby_sort = array( 
    'date' => __( 'Most Recent', 'WPL' ),
    'views' => __( 'Most Viewed', 'WPL' ),
    'likes' => __( 'Most Liked', 'WPL' ),
    'comment_count' => __( 'Most Commented', 'WPL' ), 
    'title' => __( 'Alphabetical', 'WPL' ), 
    'author' => __('Author', 'WPL'),
    'modified' => __( 'Last Modified', 'WPL' ),
    'rand' => __( 'Random', 'WPL' )
);

$orderby = get_query_var( 'orderby' );

And the output HTML for this is:

<select class="select sort" name="orderby" title="Select">

        <?php
            $html = '';
            foreach ( $orderby_sort as $o => $v ) {
                $html .= '<option value="' . $o . '"' . selected( $o, $orderby, false ) . '>' . $v . '</option>' . "\n";
            }
            echo $html;
        ?>

    </select>

Now I want to install multiple options within the array... a On and Off Option with the Framework from https://github.com/sy4mil/Options-Framework. So you can turn on and off the options in the panel. I have already tried:

 $data['order_by']['date'] .= 'date' => __( 'Most Recent', 'WPL' ),

  $data['order_by']['views'] .=   'views' => __( 'Most Viewed', 'WPL' ),

But it doesn’t work. I have no idea. What should I do?

share|improve this question
I solved the problem. – jamal Dec 9 '12 at 0:07

closed as too localized by toscho Jan 1 at 20:18

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

Browse other questions tagged or ask your own question.