Php syntaxes for the_title();

I'm using this code to make a link to a post:

printf('<a class="linkpost" title="%s" href="%s">123</a>', get_the_title($ID), get_permalink());

It works, but I need it to display post title and not 123.

How can I do this?


Just save your function return values in variables, like this.

 $title = get_the_title($ID);
 $link = get_permalink();
 printf('<div><a class="linkpost" title="%s" href="%s">%s</a></div>', $title, $link, $title);

printf('<a class="linkpost" title="%s" href="%s">%s</a>', get_the_title($ID), get_permalink(),get_the_title($ID));

you can use this

Need Your Help

Retrieve Timestamp Data to C++ from MySQL

c++ mysql sql date timestamp

I have 2 strings : startDate and endDate.