WordPress.org

Ready to get started?Download WordPress

Forums

About php code (3 posts)

  1. shojpngo
    Member
    Posted 1 year ago #

    This code run correctly.
     <?php echo '<a href="http://google.com">success</a>'; ?>

    This code run incorrectly.
     <?php echo '<a href="<?php bloginfo('url'); ?>">failure</a>'; ?>

    How should I fix this second code?

  2. catacaustic
    Member
    Posted 1 year ago #

    The second one doesn't work because you don't use <?php .. ?> tags inside other PHP tags. Remove those and it will work:

    <?php echo '<a href="'.bloginfo('url').'">failure</a>'; ?>

  3. alchymyth
    Forum Moderator
    Posted 1 year ago #

    http://codex.wordpress.org/Function_Reference/get_bloginfo

    <?php echo '<a href="' . get_bloginfo('url') . '">failure</a>'; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.