I have feeling that the following code can be shortened but have no idea how to rewrite it :)
$post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : '';
if( $post_type == 'faq' && !isset( $_REQUEST['mode'] ) )
$_REQUEST['mode'] = 'excerpt';
// if I just go with else... it doesn't work
elseif( $post_type !== 'faq' && !isset( $_REQUEST['mode'] ) )
$_REQUEST['mode'] = 'list';
Update
As you can see, !isset( $_REQUEST['mode'] )
is used twice.
$post_type == 'faq'
is also used twice, but in the elseif I'm checking negative.
Seriously there is no way to rewrite it to one if
without else
...?