[Theme] is_single & is_page not working in Twenty Ten?
-
Hi – I’m a newbie here, so please bare with me, I’ve tried searching here and the net, but without a solution so far.
I’ve just started on the “Smashing WordPress Themes” and on page 74 (working with conditional tags), I’m supposed to put in these two ‘tests’, to see if it works. Well, one deos, the other does not for some reason.
Now I’ve put his ion the loop file of the twentyten theme, just after the beginning of the loop (as there’s no-where in the book where it states which file and where to put the code in):
<?php if (is_home() || is_single_post()) { ?> <div class="ad-block"> <a href="https://tdh.me" title="Boy the book! "> Did you know I wrote another book as well? <br /> <strong>Get the Book</strong> </a> </div> <br /> <?php } ?>
<?php if ( is_single() ) { echo 'Hello World, Is Single'; } else { echo 'Not Single'; } ?>
Now, the first piece of code
(is_home())
does show on the homepage as it should – the second piece(is_single_post()))
does NOT show when viewing the page with the single post.The same goes for the second piece of code:
On homepage, it echoes ‘Not Single’ before every Gallery post (which is not on single post page), but nothing echoes out on the rest of the posts, that (as far as I know) are supposed to be single_post pages.I’ve tried with
is_page
as well which does NOT output anything as well. But usingis_archives
works fine.I’ve tried to re-install the twentyten theme, but that didn’t help
What am I doing wrong? This is driving me nuts, so I really hope someone can clarify this for me.
Thx in advance.
- The topic ‘[Theme] is_single & is_page not working in Twenty Ten?’ is closed to new replies.