On a Wordpress site my page.php contains a div that I want to exclude from a single article. I've messed around with the is_single function but I can't get it working.
Any good ideas on how I solve this?
If i get you right, you can do:
<?php if (!is_single():) ?>
<div>
//your div here
</div>
<?php endif; ?>
The solution of @niklas will work. You can also accomplish this by hiding it with CSS. You could do something like this:
.page div.class{
display:none;
}
Replace .class
with the class (or ID) of the div
you want to hide
Or to hide it on a specific page (or post) you can use the ID class:
.page-id-1 div.class{
display:none;
}
Replace 1
with the ID of the page where you want to hide the div
You can find more information about the available CSS-classes on https://codex.wordpress.org/Function_Reference/body_class.