Reputation: 37
I want to add conditional statement in author. something like if the author is an admin set this to null. is this possible?
$args = apply_filters( 'job_manager_get_dashboard_jobs_args', array(
'post_type' => 'job_listing',
'post_status' => array( 'publish', 'expired', 'pending' ),
'ignore_sticky_posts' => 1,
'posts_per_page' => $posts_per_page,
'offset' => ( max( 1, get_query_var('paged') ) - 1 ) * $posts_per_page,
'orderby' => 'date',
'order' => 'desc',
'author' => get_current_user_id()
));
Upvotes: 2
Views: 178
Reputation: 1358
I assume that get_current_user_id()
is getting an id for author.
Change your code from this:
'author' => get_current_user_id()
With this:
'author' => ((get_current_user_id() == 'admin') ? NULL : get_current_user_id())
Upvotes: 4
Reputation: 816
I think you can use this sample code.
<?php
$array = array('test' => testFunction());
function testFunction()
{
// do your condition here
// return 'a';
}
print_r($array);
?>
Upvotes: 0