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?