jbwebdesign Posted January 5, 2012 Report Share Posted January 5, 2012 Hello everyone, i have a question..... this might sound like a dumb question but i am working on a wordpress theme and i want to concatenate using the following.... <?php bloginfo('url'); ?> i want this to do this but it's not working..... <?php $path = 'test/test_path/file.php'; include(bloginfo('url') . $path); ?> can someone please help me Quote Link to comment Share on other sites More sharing options...
cugopob.vlad Posted January 6, 2012 Report Share Posted January 6, 2012 (edited) Hello everyone, i have a question..... this might sound like a dumb question but i am working on a wordpress theme and i want to concatenate using the following.... <?php bloginfo('url'); ?> i want this to do this but it's not working..... <?php $path = 'test/test_path/file.php'; include(bloginfo('url') . $path); ?> can someone please help me Im not exactly sure that this will work, as I havent done anything with wordpress in a while, but from what they have on the wordpress functions info at http://codex.wordpress.org/Function_Reference/bloginfo <?php bloginfo('url'); would return http://example/home, so im assuming that you are just missing a backslash in you $path variable. It should look like <?php $path = '/test/test_path/file.php'; Edited January 6, 2012 by cugopob.vlad Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 6, 2012 Report Share Posted January 6, 2012 As far as I understand it, your issue is that the path is automatically printed to the browser -- it isn't intended to act as a variable like you are trying to use it. If you take a look at the description of bloginfo() in the Wordpress function reference, it says this: This always prints a result to the browser. If you need the values for use in PHP, use get_bloginfo(). http://codex.wordpress.org/Function_Reference/bloginfo So I'd suggest you look at get_bloginfo() instead. Quote Link to comment Share on other sites More sharing options...
jbwebdesign Posted January 6, 2012 Author Report Share Posted January 6, 2012 yes, that was the issue that i was having. It was printing to the browser instead of returning the result and allowing me to store it in a variable. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.