• So i have created a bunch of php files within my theme, for example an “about us” file and several others. Each file includes my standard header.php file – adds content- then footer.php file.

    I have a drop down navigation menu which i want to link to this about us page. However when i include the full url in the nav menu i get this message:

    Warning: main(ABSPATHwp-blog-header.php) [function.main]: failed to open stream: No such file or directory in url/header.php on line 1

    Warning: main(ABSPATHwp-blog-header.php) [function.main]: failed to open stream: No such file or directory in url/header.php on line 1

    Warning: main(ABSPATHwp-blog-header.php) [function.main]: failed to open stream: No such file or directory in url/header.php on line 1

    Fatal error: main() [function.require]: Failed opening required ‘ABSPATHwp-blog-header.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in url/header.php on line 1″

    If i want to link to an external site there are no issues, so how do i
    link to files that exist in the current theme?

    cheers

Viewing 9 replies - 1 through 9 (of 9 total)
  • Maybe you should try to link to every page as an external site, including the “http://yoursite.com/whatever.php”

    You’re not linking directly to page templates are you?

    Thread Starter andy_b

    (@andy_b)

    no.
    i created a php file and placed it in my theme directory.
    i am trying to link to this file.

    eg. about.php contains

    <?php include(‘header.php’); ?>
    <div>hello</div>
    <?php include(‘footer.php’); ?>

    about.php is located in same directory as header, footer and template files

    I’m still not understanding what you’ve done. You’ve created a file called about.php and your’re trying to link to it in the nav menu? If so it sounds like you are trying to link directly to the PHP file. Why not just create a page called “about” and link to it?

    Thread Starter andy_b

    (@andy_b)

    i understand i can create pages in the wordpress interface however i am trying to work out why i can not seem to link to a file i have created in my theme directory.

    is there a reason for it? does wordpress not allow it?

    yes it does. you havent demonstrated a link though

    this is a link: http://www.link.com

    what you have started describing above is including files .. which isnt the same.

    what in your navigation bar that supposedly contains links?

    Thread Starter andy_b

    (@andy_b)

    i am trying to link to a file in the theme.
    So i enter the absolute path to it from within the nav.

    something like this:
    http://www.mydomain.com/…/theme/about.php

    and i get the error message stated in the initial post

    any ideas why i would get that?

    sure.

    look at the errors. the problem isnt with about.php .. its with what you are including within THAT file, which is header.php.

    Warning: main(ABSPATHwp-blog-header.php) [function.main]: failed to open stream: No such file or directory in url/header.php on line 1

    the only thing that ought to even be trying to load wp-blog-header.php is your root index.php file. Not a theme file.

    what you really need to do is use a pastebin service (google pastebin), and paste EXACTLY what is inside your about.php and paste exactly what is inside your header.php that you are trying to include. then link to that pastebin entry so that we can see.

    Having done all of this myself, I assure you it does work, if done correctly.

    Thread Starter andy_b

    (@andy_b)

    So the category.php, archive.php, index.php, and single.php all have the header.php included. and they all work fine, and they all reside in the same directory as about.php.

    i guess i was hoping to just to make updating things in the future easier by including the header file that already exists.

    ok let me see if i can paste some code

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘link to pages in theme’ is closed to new replies.