I’m passing some variables to a (wordpress) function as following:
wp_list_categories('exclude=4&title_li=');
Instead of hard coded values for exclude (ie. 4,7), I want to pass a variable in it.
I am trying following but getting syntax error.
$exclude = 4;
wp_list_categories('exclude='.<?php echo $exclude; ?> .'&title_li=');
Can you help fixing it? Thanks.
The easiest change would be this
Alternatively, you can use double quotes then encase the variables in { } – in general, I prefer not to do this as it makes it slightly less obvious what you’re doing, at a glance.