Ready to get started?Download WordPress


About php code (3 posts)

  1. shojpngo
    Posted 2 years 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
    very awesome
    Posted 2 years 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. 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


No tags yet.