samedi 6 octobre 2018

how to add if statment inside an arrgument array of wordpress

I have a question about if statment inside wordpress argument which is an array.

I would like just to add 's' => $search_term to the argument incase if there is a search term.

 $args = array(
if search_term then echo 's' => $search_term 
);

I know i can write many arrgument and then using if statment outside the array but that is way is not what am wishing to do.

Aucun commentaire:

Enregistrer un commentaire