March 18, 2013
Add php within a string
Question by Brown
I want to take
$imgsrc = get_template_directory_uri() . '/s.php?strings=';
and add the_content_rss('', TRUE, '', 4)
after strings.
How do I go about doing that?
$imgsrc = get_template_directory_uri() . '/titles.php?strings=' . the_content_rss('', TRUE, '', 4);
doesn’t seem to output a single URL.
Answer by Starx
First thing that you should understand is
String concatenation requires functions that return value not output/echo them.
So, make sure get_template_directory_uri()
and the_content_rss('', TRUE, '', 4);
returns a value instead of displaying them. If both functions return a value, the URL should be build as expected.