Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_shortcode( 'sort_by' , 'mars_orderblock_videos' );
- if( ! function_exists( 'videotube_prefilter_main_video_args' ) ){
- /**
- *
- *
- * Filter the main video args
- *
- * @param array $args
- * @param string $id
- *
- *
- */
- function videotube_prefilter_main_video_args( $args, $id = '' ) {
- if( isset( $_GET['order_post'] ) && in_array( $_GET['order_post'] , array( 'latest', 'liked', 'viewed', 'comments' )) ){
- switch ( $_GET['order_post'] ) {
- case 'liked':
- case 'viewed':
- $args['orderby'] = 'meta_value_num';
- if( $_GET['order_post'] == 'liked' ){
- $args['meta_key'] = 'like_key';
- }
- else{
- $args['meta_key'] = 'count_viewed';
- }
- break;
- case 'comments':
- $args['orderby'] = 'comment_count';
- break;
- case 'latest':
- $args['orderby'] = 'date';
- break;
- }
- }
- return $args;
- }
- add_filter( 'mars_sc_videotube_args' , 'videotube_prefilter_main_video_args', 10, 2 );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement