WordPress.org

Forums

[resolved] Adding URL code within an echo command (3 posts)

  1. HorrorUK
    Member
    Posted 2 years ago #

    Hi,

    I have a plugin that doesn't quite do what I want. If a user isn't logged in, it tells them they need to log in, but doesn't give a link, so I'd like to add the link.

    This is the original code:

    elseif (!is_user_logged_in()) echo "<p>If you want to add yourself to this blog, please log in.</p>";

    I tried the following, but it gave a 500 error:

    elseif (!is_user_logged_in()) echo "<p>If you want to add yourself to this blog, please <a target="_blank" href="/">log in</a> or <a target="_blank" href="/wp-signup.php">sign up to the network</a> then refresh this page.</p>";

    Is there a way in which I can do this?

    Thanks.

  2. bythegram
    Member
    Posted 2 years ago #

    I'm pretty sure you could do this by changing the " to ' for the echo:

    elseif (!is_user_logged_in()) echo '<p>If you want to add yourself to this blog, please <a target="_blank" href="/">log in</a> or <a target="_blank" href="/wp-signup.php">sign up to the network</a> then refresh this page.</p>';

  3. HorrorUK
    Member
    Posted 2 years ago #

    Thanks bythegram, that did the job perfectly.

    Sometimes it is better to look for the simple solution first :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.