WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem by $output in a plugin in My custom Template, I do it this:

$output .= "<h2><a href='".the_permalink()."' title='" .printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) )"' rel="bookmark">'".php the_title()."'></a></h2>";

But the link doesn't work it return just the normal text and not the link to the post, can somebody help me?

share|improve this question

The template tags the_permalink and the_title do not return values, they echo them.
Use get_permalink and get_the_title instead.

As an aside, the earlier are simply wrappers that echo the return of the latter.
As another aside, yes, the naming is inconsistent. (And yes, that's annoying. At least to me.)

share|improve this answer
Tnk for yuor answer, I change it but now it reports a problem on the line and doesen't works, Can U write a complete line please? – Skugnizz Jun 4 '13 at 22:37
Ok now it work I do it this: $output .= "<h2><a href='".get_permalink()."'>".get_the_title()."</a></h2>"; tnk a lot!! – Skugnizz Jun 4 '13 at 22:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.