WordPress.org

Ready to get started?Download WordPress

Forums

Help need for using conditional tags (5 posts)

  1. Truth
    Member
    Posted 8 years ago #

    I'm trying to use the conditional tags for my comments template. I have this

    <?php
    if (is_page()) {
    if (is_page('guestbook')) {
    echo "<h1 id='respond'>";
    echo ImageHeadline_render( 'Sign the guest book' );
    echo "</h1>";
    }
    if (is_page('144')) {
    echo "<h1 id='respond'>";
    echo ImageHeadline_render( 'Submit your site and comments' );
    echo "</h1>";
    } }
    else {
    echo "<h1 id='respond'>";
    echo ImageHeadline_render( 'Leave a reply' );
    echo "</h1>";
    }
    ?>

    The guestbook page turns out well, but for the page 144, the header render the 'Submit your site and comments' and also the 'Leave a reply', and for the rest of the pages, no title shows up at all. Is there anything wrong with my code?

    This template is used on my paged comments template.
    I wanted "Sign the guest book' to shows up on the guestbook page, the 'Submit your site and comments' for page 144 and 'Leave a reply' for the rest of the pages.

    All help would be appreciated. Thank you.

  2. MichaelH
    Member
    Posted 8 years ago #

    What is ImageHeadline_render?

  3. Truth
    Member
    Posted 8 years ago #

    That is the code for the image headlines plugin.

    I think I fixed it, thanks :)

  4. MichaelH
    Member
    Posted 8 years ago #

    Truth--please consider describing how you resolved the problem so that your fellow WordPress users can learn from your experience.

    Thanks.

  5. Truth
    Member
    Posted 8 years ago #

    sure :)

    basically this is the working one

    <?php
    if (is_page()) {
    if (is_page('guestbook')) {
    echo "<h1 id='respond'>";
    echo ImageHeadline_render( 'Sign the guest book' );
    echo "</h1>";
    } elseif (is_page('144')) {
    echo "<h1 id='respond'>";
    echo ImageHeadline_render( 'Submit your site & feedbacks' );
    echo "</h1>";
    } else {
    echo "<h1 id='respond'>";
    echo ImageHeadline_render( 'Leave a reply' );
    echo "</h1>";
    }
    }
    ?>

    comparing the code, the second one should be elseif and not if =D

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.