What is wrong with this?
echo '<a title="Last Chance" href="'.the_permalink().'" class="status open">Last Chance</a>';
As it’s putting the the_permalink()
before the <a
instead of inside it.
What is wrong with this?
echo '<a title="Last Chance" href="'.the_permalink().'" class="status open">Last Chance</a>';
As it’s putting the the_permalink()
before the <a
instead of inside it.
You must be logged in to post a comment.
WordPress often
echo
‘s the content out of the function instead of returning it.Use
get_permalink()
instead.http://codex.wordpress.org/Function_Reference/get_permalink
http://codex.wordpress.org/Function_Reference/the_permalink
Actually it looks good to me (but see my edit comment).
Better is to embed PHP into HTML:
Edit: As @Marwelln found out,
the_permalink()
is already echoing data. Still, this is a better solution than echoing the HTML.I guess you have
echo "abc"
in thethe_permalink
function. In order for this to work as you wish, you have toreturn "abc"
instead of usingecho
.Use it like this (not inside echo )
See http://codex.wordpress.org/Function_Reference/the_permalink for more details.