Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Anda Pop

    (@andapop)

    Hello,
    I see this is marked as resolved, but the sorting by likes/dislikes is not working for me.
    I tried it on a fresh WP 4.5.1 install, with twentysixteen as a theme, and no other active plugins.

    I looked through the plugin’s code s bit and I couldn’t find where you set how the query var ‘orderby’ gets interpreted when it is equal to ‘likes’ or ‘dislikes’.
    Did I miss something in the code? Is this implemented in a different way?

    I tried a fix, that seems to work (add the code to functions.php)

    function vortex_system_column_orderby( $vars ) {
    	if ( isset( $vars['orderby'] ) ) {
    		if( 'likes' == $vars['orderby'] ) {
    			$vars = array_merge( $vars, array(
    				'meta_key' => 'vortex_system_likes',
    				'orderby' => 'meta_value_num'
    			) );
    		} elseif ( 'dislikes' == $vars['orderby'] ) {
    			$vars = array_merge( $vars, array(
    				'meta_key' => 'vortex_system_dislikes',
    				'orderby' => 'meta_value_num'
    			) );
    		}
    	}
    
    	return $vars;
    }
    add_filter( 'request', 'vortex_system_column_orderby' );

    mabe you forgot and opened comment block (forgot the */)
    http://johnlamansky.com/tech/php-fatal-flex-scanner-internal-error/

Viewing 2 replies - 1 through 2 (of 2 total)