I’m not sure whats wrong with this line. Have I place this incorrectly? How do I get it to recognize the $yourcat->slug;
$cat = get_query_var('cat');
$yourcat = get_category ($cat);
$uri = $_SERVER['REQUEST_URI'];
if (($uri == '/category/$yourcat->slug;') {
your syntax is wrong change the single quotation mark to a double quotation mark and remove the semicolom
on this line:
it should become:
AND you can surround the variable with curly brackets
when you use single quotes, php does not look in the string for variables to replace. when you use double quotes it does. But in some cases there can be confusion such as this case. So when you do object reference like this, it’s best to use the curly braces to explicitly say this is a variable that should be replaced.