Support » Fixing WordPress » Help Explain is_single() Condition

  • I’m trying to echo some text in a sidebar if we are displaying a single post. I’m having trouble understandin the is_single() conditional statement.

    This is the line that doesn’t seem to work:

    if (is_single())
    echo ‘this is a single post’

    The statement is in sidebar.php. What am I doing wrong? Thanks,


Viewing 3 replies - 1 through 3 (of 3 total)
  • replace 'this is a single post' with
    'this is a single post';

    I added the ‘;’ and it still doesn’t print.

    I’ve also tried the following, without any luck:

    Removed the conditional statement
    Removed the echo statement, leaving just plain text.

    The theme — Cory Miller’s RockinPaper — prints an ‘About’ statement in the sidebar, using simple text. I’ve seen other themes use is_single effectively.

    My goal is to print a sidebar block, listing print, subscribe, and share options for posts.

    My theme has an “about” statment using a condition but it’s called by sidebar.php after it checks to see if a dynamic sidebar (widgets) is used. Consequently, the ‘about’ statement doesn’t appear because I use a dynamic sidebar.

    So if you’re using widgets, move the ‘about’ code text in your theme before the call to the dynamic sidebar check.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Help Explain is_single() Condition’ is closed to new replies.