Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using this code to show custom code on single posts.

function post_footer() {
if (is_single())
<div class="custom">
    <h1><a href="<?php the_field('live_demo'); ?>" target="_blank">Live Demo of <?php the_title(); ?><h1>
            <h1><a href="<?php the_field('download'); ?>" target="_blank">Download<h1>

How to edit so div should appear only on single post of specified categories, not on all posts.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

If it is a single page: is_single() returns TRUE.

If a $post is in a specific category: in_category( $cat ) returns TRUE. It needs $cat as ID, name or (string) slug.

Anyway: Searching for a list of conditional tags isn´t that hard.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.