Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quick PHP echo help

Tags:

php

wordpress

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.

like image 393
Cameron Avatar asked Apr 06 '26 07:04

Cameron


1 Answers

Wordpress often echo's the content out of the function instead of returning it.

Use get_permalink() instead.

echo '<a title="Last Chance" href="'.get_permalink().'" class="status open">Last Chance</a>';

http://codex.wordpress.org/Function_Reference/get_permalink http://codex.wordpress.org/Function_Reference/the_permalink

like image 117
Marwelln Avatar answered Apr 08 '26 21:04

Marwelln



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!