Jump to content

Recommended Posts

Posted

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 :)

Posted (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 by cugopob.vlad
Posted

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.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...