• I have a site, skinsfan.net, and my index page includes wordpress as a form of updating. I want to know how to keep the same layout on every page, like cast.php or site.php. I know about php and php includes and i tried what i thought might work which was setting up the page like this

    <?php include('/wp-content/themes/skinsfan_v1/header.php'); ?>
    
    CONTENT GOES HERE
    
    <?php include('/wp-content/themes/skinsfan_v1/footer.php'); ?>

    but it came up with this on the page

    Warning: include(/wp-content/themes/skinsfan_v1/header.php) [function.include]: failed to open stream: No such file or directory in /home/fakefan1/public_html/skinsfan.net/cast.php on line 1
    
    Warning: include() [function.include]: Failed opening '/wp-content/themes/skinsfan_v1/header.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/fakefan1/public_html/skinsfan.net/cast.php on line 1
    CONTENT GOES HERE
    Warning: include(/wp-content/themes/skinsfan_v1/footer.php) [function.include]: failed to open stream: No such file or directory in /home/fakefan1/public_html/skinsfan.net/cast.php on line 5
    
    Warning: include() [function.include]: Failed opening '/wp-content/themes/skinsfan_v1/footer.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/fakefan1/public_html/skinsfan.net/cast.php on line 5

    Please help me solve this problem.

Viewing 8 replies - 1 through 8 (of 8 total)
  • for header.php and footer.php it is:

    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    for other template pages it is:

    <?php include("yourtemplate.php") ?>

    if the template file is in the same directory as header.php, for instance.

    Thread Starter skinsfan

    (@skinsfan)

    so i changed my coding to

    <?php get_sidebar(); ?>
    
    CONTENT GOES HERE
    
    <?php get_footer(); ?>

    and the new error message is

    Fatal error: Call to undefined function get_sidebar() in /home/fakefan1/public_html/skinsfan.net/cast.php on line 1

    my mistake: instead ‘sidebar’ it should read ‘header’.

    or use: <?php include('header.php') ?> .

    you can read more in the wordpress codex.

    Thread Starter skinsfan

    (@skinsfan)

    this still does not work and it comes up with

    Fatal error: Call to undefined function get_header() in /home/fakefan1/public_html/skinsfan.net/cast.php on line 1

    i already tried using php include, that was the first thing i tried.

    That’s because your non-wordpress pages don’t understand the function, those functions don’t exist in the non-wordpress environment.

    It’s explained more here.
    https://wpengineer.com/embed-wordpress-functions-outside-wordpress/

    Not sure how well it works or if it’s safe, but that’s how you’d essentially get it done..

    Thread Starter skinsfan

    (@skinsfan)

    oh wow, thanks t31os_ ! that worked. thanks so much!

    You’re welcome ??

    Thread Starter skinsfan

    (@skinsfan)

    I was just wondering, is there another way to do this? As every time you click a new page it goes white for a while, yet on other sites that use wordpress and php that doesnt happen.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Keep theme on all pages’ is closed to new replies.