That’s not how you chain multiple conditions with an if
statement. Try this
<ul>
<?php foreach ($categories as $category) { ?>
<?php if ($category->name !== 'Slides' && $category->name !== 'Uncategorized') { ?>
<li><?php echo $category->name; ?></li>
<?php } else { ?>
<li>Unknown</li>
<?php } ?>
<?php } ?>
</ul>