Adding a file to a template
-
I want to add another file to my template. But where do I include the file so it will be read?
-
You will have to give a bit more details to help us to understand what do you want.
What file? Will it be in the theme folder? Should it be included in another file…?Yup~! I also face same difficulty in adding a new page template inside the templates selection.
For the Default Themes(wp-content/themes/default), when you write a page, there’s a drop down menu for us to choose the Page Template. (Achieves, Links 2 selection for use)
*Copy the file into the folder doesn’t add a new links for the page template.But most of others themes doesn’t support this page template section.
Is there anyway to add a new page selection selection inside it? I hope to get more detailed answer, eg: which page to edit 2 add new selection.
@wkwebsite
Your question should be ” how to add a template file to a theme” – which is completely different from the OP question.Anyway, read my post in thsi thread and ALL the answers till down)
http://ww.wp.xz.cn/support/topic/66590?replies=13#post-352680
if you have more questions post back.Sorry, should have been more clear.
I made a custom theme by copying the Default theme and modifying it. I need to call a function from header.php of this theme, and the function is in a separate file which isn’t part of the theme, but I don’t want to put the function in functions.php because a different part of my site uses the function. So, I tried using include() at the top of header.php to include the file that has the function, and it gave me this output:
Warning: main(): URL file-access is disabled in the server configuration in /home/.cattastrophie/thebytefactory/the-byte-factory.com/blog/wp-content/themes/the-byte-factory/header.php on line 1
Warning: main(http://the-byte-factory.com/template.php): failed to open stream: no suitable wrapper could be found in /home/.cattastrophie/thebytefactory/the-byte-factory.com/blog/wp-content/themes/the-byte-factory/header.php on line 1
Warning: main(): URL file-access is disabled in the server configuration in /home/.cattastrophie/thebytefactory/the-byte-factory.com/blog/wp-content/themes/the-byte-factory/header.php on line 1
Warning: main(http://the-byte-factory.com/template.php): failed to open stream: no suitable wrapper could be found in /home/.cattastrophie/thebytefactory/the-byte-factory.com/blog/wp-content/themes/the-byte-factory/header.php on line 1
Warning: main(): Failed opening ‘http://the-byte-factory.com/template.php’ for inclusion (include_path=’.:/usr/local/lib/php’) in /home/.cattastrophie/thebytefactory/the-byte-factory.com/blog/wp-content/themes/the-byte-factory/header.php on line 1
So, how do I include the file I need?
EDIT: Thanks, I’ll read your post.
Jupiter, that post was for the other poster, not for you 🙂
For you: when using include you do not use URI, you use internal path!
Oh okay, haha. Well, I learned something anyway.
Ah, there’s the problem. Thanks, everything works now.
The topic ‘Adding a file to a template’ is closed to new replies.