Linking to pages in root folder
Also, consider using the very useful bloginfo in your WordPress template files:
I’m currently using bloginfo() for linking stylesheets and images WITHIN the WordPress folder. I may have overlooked it but can bloginfo assist me in linking to files outside of WP’s root folder?
For links outside of WordPress, just code absolute links into your theme or add them to your blogroll bookmarks in their own category and then use wp_list_bookmarks to display just that category in your theme files.
Maybe using something like this may work:
<base href=”http://www.yourwebsite.com/root” />
If I did decide to keep everything, including my blog, in my root directory.. what would be my desired path to link to static pages within the same directory? I was assuming that if I had my navigation in my header.php file.. and I wanted to link to my contact.php, I would just do a href=”contact.php”.. However, that path would be incorrect since it would link to my root folder and not to the template location where my theme and static pages are.
– index.php (WordPress)
– header.php (WordPress)
– sidebar.php (WordPress)
– footer.php (WordPress)
– contact.php (static)
Because of its dynamic nature and variety of different content paths (post, page, index, category, tag, archive, etc.), within WordPress, you need to use absolute links, not document relative ones.
This page has info on absolute links:
I’m looking to do the same thing airporte is. I guess I’ll stick to absolute links but would love to know if someone came up with how to use a line of php to look one (or whatever user set number) folder above the WordPress folder. You would use it in the same way as bloginfo.
- The topic ‘Linking to pages in root folder’ is closed to new replies.