1

I have an include

include ('myfile.php');

Now, I am using wordpress and to get the template path I use:

<?php echo get_template_directory_uri(); ?>

My question is:

How can I use both together?

Like:

<?php

include('<?php echo get_template_directory_uri(); ?>/myfile.php');

?>

Thanks

2 Answers 2

6
include(get_template_directory_uri() . "/myfile.php");

The include() function just takes a string parameter. Nothing special about it.

Sign up to request clarification or add additional context in comments.

1 Comment

include(): http:// wrapper is disabled in the server configuration by allow_url_include=0
2

You can use the result of the function in the include, but not by echo:ing it. Just use it directly.

<?php
include(get_template_directory_uri() . '/myfile.php');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.