I have the following code to WP_Query
. But I am not much good in PHP and WordPress, so please help me to solve this.
$args = array(
'post_type' => 'job',
(isset($gender)) ?
('meta_key' => 'gender',
'meta_value' => $gender)
: '');
$query = new WP_Query( $args );
But its showing this error and I am not sure, how to format it.
Parse error: syntax error, unexpected T_DOUBLE_ARROW in XXX
How can I format it to make array like this.
$args= array( 'post_type' => 'job',
'meta_key' => 'gender',
'meta_value' => $gender
);
Try this :