• My adventures in trying to create different templates for daily and monthly archives continue… Today I am having difficulty getting is_day and is_month to work within the loop without throwing up parse errors. Are they even supposed to work within the loop? Should I be putting the loop inside the conditional statements? Should I give up and try again when I’m less rubbish at PHP?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I’ve five different if statements in The Loop of my main index.php that make use of the conditionals, all without problem. Would help in debugging to know what the errors are you’re seeing.

    And we’re all about rubbish here!

    Thread Starter notthatugly

    (@notthatugly)

    Thanks, I should be ok now I’ve found some sample code to work from. Basically I had no idea how to use functions inside an echo, and that’s what was causing the difficulties.

    (Please consider adding your example of use within the loop to the codex! There may be others like me who assume from the current page that conditional tags are designed exclusively for sidebars.)

    “Please consider adding your example of use within the loop to the codex!”

    Will do.

    Thread Starter notthatugly

    (@notthatugly)

    Once more I have overestimated my abilities and cannot, in fact, get the sample code to work either. I get a ‘Parse error: unexpected <‘ the line after the conditionals end.
    To my eye it looks slightly odd that there’s no closing ?> to finish off the conditional statements, but maybe that’s how it’s supposed to be? In any case, when I add one I get ‘unexpected $end’ on the last line of the template.

    That’ll teach me for trying to show off. I just wish month.php had existed after all, it would have saved me a lot of frustration.

    The example code on Codex did have a missing closing PHP tag. I’ve corrected it.

    Showing off is still acceptable…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘do conditional tags work inside the loop?’ is closed to new replies.