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?


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.)

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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