Get exclusive CAP network offers from top brands

View CAP Offers

wpress problem: is_single(x) not working in templated pages.

You have affiliate marketing questions. CAP has answers!Category: Website Design and Developmentwpress problem: is_single(x) not working in templated pages.
alexross asked 4 years ago
I use wordpress on 1 of my sites..

I’m having a problem using the following code in my sidebar [in php tags]

if ( is_single(“poker”))
echo (“POKER”);
[/CODE]

The “poker” page uses a custom template which includes the sidebar – yet nothing is printed.. the same code works fine on other non-custom-templated pages ….

anyone got any ideas? google yields nowt.
cheers[CODE]
if ( is_single(“poker”))
echo (“POKER”);
[/CODE]

The “poker” page uses a custom template which includes the sidebar – yet nothing is printed.. the same code works fine on other non-custom-templated pages ….

anyone got any ideas? google yields nowt. <span title=” title=”” class=”bbcode_smiley” />
cheers

2 Answers
TonyP answered 4 years ago
Not an expert at all at php/wp but should it not be single quotes like in the code below?
And can’t you use the “is_page_template” instead?

Code:
re”>is_page_template(‘poker.php’)

Or maybe is_page(‘Poker’) instead of is_single if it's a Page not a Post named Poker <span title=" title="" class="bbcode_smiley" />

alexross answered 4 years ago
@TonyP 203794 wrote:

Not an expert at all at php/wp but should it not be single quotes like in the code below?
And can’t you use the “is_page_template” instead?

Code:
re”>is_page_template(‘poker.php’)

Or maybe is_page(‘Poker’) instead of is_single if it's a Page not a Post named Poker <span title=" title="" class="bbcode_smiley" />

nah the wpress syntax for the function has dbl quotes. you use either the page ID, the stub or the page name..

edit: it works ok when I set it to use the default template, so it’s definitely a template issue <span title=” title=”” class=”bbcode_smiley” />

the possible solution you gave above won’t work for me as I have a bunch of pages using the poker_tempate template, but only want to echo the text on the sidebar of the “poker” page, which uses this template.