Reputation: 73
Im am trying to add a php to dynamically display rss within the search results pages on my WordPress site. The $XMLFILE below is suppose to have the url to the rss feed I want to display.
$XMLFILE = "http://www.bing.com/search?q=SEARCH-QUERY-GOES-HERE&format=rss";
Now, the thing is I want to use another php in the $XMLFILE where it says SEARCH-QUERY-GOES-HERE. Like this example:
$XMLFILE = "http://www.bing.com/search?q=<?php printf( __( '%s', 'twentytwelve' ), '' . get_search_query() . '' ); ?>&format=rss";
Problem is, how do I put php inside of this to complete the url?
This php I got from wordpress and display the search term searched on the site
<?php printf( __( '%s', 'twentytwelve' ), '' . get_search_query() . '' ); ?>
SO now I have been trying to put the two together so when the user searches may APPLES it will show in the $XMLFILE where it say SEARCH-QUERY-GOES-HERE the word APPLES and therefore displays the rss for the keyword APPLES. APPLES is just the example keyword I used to try to illustrate what I am asking.
Get what I am asking? ANyone know how to add php inside php like this or a better option to add a Wordpress search term into $XMLFILE where it says SEARCH-QUERY-GOES-HERE?
Thanks in advance!
Upvotes: 0
Views: 72
Reputation: 3454
Assuming I understand this question, you could do something like this:
$more = __( get_search_query(), 'twentytwelve' );
$XMLFILE = "http://www.bing.com/search?q=$more&format=rss";
In double-quotes, variables can be placed inline. As done above. You can then run __()
above, and put the result in a variable. This will get the wanted result.
Upvotes: 1