This:
echo '<br>';
$author_single = sprintf( '/%s/single.php', 'francadaval' );
echo ( $author_single );
echo '<br>';
$author_single = sprintf( '/%s/single.php', the_author_meta( 'nickname') );
echo ( $author_single );
echo '<br>';
$nick = the_author_meta( 'nickname');
$author_single = sprintf( '/%s/single.php', $nick );
echo ( $author_single );
show this:
/francadaval/single.php
francadaval//single.php
francadaval//single.php
I saw that the concatenation order is affected by the function call so I tried to use a intermediate variable but it doesn’t work.
Using dot operator instead of sprintf or with "/{$nick}/single.php" does the same.
The function the_author_meta is a WordPress function to get data from the author of a post and in this case must returns the author’s nickname (‘francadaval‘).
How can I get this working so $author_single results to be ‘/francadaval/single.php’ using the function call for the nickname of the author?
Thanks.
You should use
get_the_author_metainstead ofthe_author_meta.the_author_metadisplay author metaget_the_author_metareturn author meta