WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Help with simple PHP if/then or if/else statements (3 posts)

  1. WPChina
    Member
    Posted 7 years ago #

    I need help with PHP if/then statements. I am using the FeedWordpress plugin and I am using the following code:

    <?php if (is_syndicated() and (get_the_author() !== get_syndication_source())):
    echo ' <a target="_blank" href="'; the_syndication_source_link();
    echo '">';
    the_syndication_source();
    echo '</a>';
    endif; ?>

    The code above prints out the URL for the syndicated source, and works great.

    However, I am also posting my own posts on my blog, and I want something to show up instead of the URL if it is a post from my own blog. Therefore, I need some simple suggestions on how to change the code above into an if/else or if/then statement to show some other text if the post is NOT a syndicated post. (I'm not a PHP guru so my vocabulary might be incorrect)

    Tks!

  2. Austin Matzko
    Member
    Posted 7 years ago #

    Right above the endif; you would put an else : followed by the code you want to execute then.

  3. WPChina
    Member
    Posted 7 years ago #

    Solved!!! THANK YOU! :-)

Topic Closed

This topic has been closed to new replies.

About this Topic