WordPress.org

Ready to get started?Download WordPress

Forums

Fatal error: Call to undefined function get_header() (14 posts)

  1. Patrick Orr
    Member
    Posted 3 years ago #

    I am trying to get the new wordpress up and running on my website with a custom theme. I used the theme "starkers" as a clean slate to start. I set up the database, installed the theme.

    I get a fatal error that says:
    "Fatal error: Call to undefined function get_header()...."

    I have scoured the forum and checked all the problems other people have been having:

    1. My database is fine
    2. The index.php file in the root folder is intact

    I don't understand what the problem is, does anyone have a clue.

    Here is the site url(if that helps)

    I should mention that I am working 'online' and have a index.html file in the root so that visitors are greeted by something until the site is up and running.

    Thanks in advance for any help!

  2. Simon Prosser
    Theme Review Admin
    Posted 3 years ago #

    What version of WordPress did you install?

  3. Digital Raindrops
    Member
    Posted 3 years ago #

    There are a number of failed files:

    <link charset="utf-8" title="no title" media="screen" type="text/css" href="css/style.css" rel="stylesheet">
    Failed to load source for: http://www.clementineandclover.ca/css/style.css

    It looks like you have not installed wordpress or the theme correctly?
    How did you load the theme, and did you load it to the right directory level?

    Regards

    David

  4. Patrick Orr
    Member
    Posted 3 years ago #

    Hey there, Thanks for the quick replies!

    I am using the latest version of wordpress 3.0.2
    To install the theme I simply uploaded it to the themes folder. Then when I logged into wp-admin I just selected the theme and started using it.

    To test the index file I navigate to this page:
    http://www.clementineandclover.ca/wp-content/themes/clementineandclover/index.php

    This is where I receive the error. I generally use firebug to debug my sites but am not having any luck with this one as it just returns empty head and body tags:(

    Re: adaptris:
    Where did you see that I was missing files? All I get are the empty body tags.

    Question:
    Should it be possible to have wordpress installed and have a seperate landing page to greet visitors in the mean time? If so am I going the right route to navigate directly to the theme folder's index file for test?

    Hope this gives you an idea of what I'm up against.
    Looking forward to your replies!

  5. Simon Prosser
    Theme Review Admin
    Posted 3 years ago #

    Ah well theres your problem, you never navigate to the theme files, wordpress will do that for you. http://www.clementineandclover.ca/

  6. Patrick Orr
    Member
    Posted 3 years ago #

    The file that loades when you visit http://www.clementineandclover.ca/ is not even part of the wordpress theme.

    It is a index.html file that I have in my root folder. I wanted to have something to greet visitors of the site.

    That being said, it would appear that wordpress is not using the theme correctly? In the wp-admin I have logged in and created a index.php file in the theme folder. There is a page template name 'homepage' that is selected to be used as the static landing page. The page at http://www.clementineandclover.ca/ is not this page, it is the HTML file in the root.

    Questions:

    1. How can I have wordpress installed and develop the theme without interfering with the custom landing page?

    2. How can I get my theme to be read correctly and working?

  7. Digital Raindrops
    Member
    Posted 3 years ago #

    Hi Patrick,
    You have tested WordPress with the default theme and all is well?

    I have downloaded "starkers", and I think that you may have a syntax error in the index.php file, the get_header(); call is on line 16.

    If you have stripped down the comments then you may have a missing code tag, the index.php should look something like:

    <?php /* Your Commment Here */ ?>
    <?php get_header(); ?>
    	<?php get_template_part( 'loop', 'index' ); ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    HTH

    David

  8. Digital Raindrops
    Member
    Posted 3 years ago #

    Another thing to try is the default theme, I would expect to see the twenty ten screenshot with this link, which was broken.

    WordPress uses twenty ten as a fall back theme, and the starkers theme uses the same namespace, install or upload twenty ten as well.

    Edit:
    I see the error has gone, was it code or the mising twenty ten theme?

    HTH

    David

  9. Patrick Orr
    Member
    Posted 3 years ago #

    David,
    I did install the twenty ten theme and it did not seem to make a difference it was still returning the error.

    In addition I tried adding the loop to the index.php file but that did not fix the error either.

    I decided to remove:<?php get_header(); ?>, <?php get_footer(); ?> and everything started working fine.

    Did you see my message above about running wordperss in the background and having an HTML landing page until the site is ready? It seems to me like this might be a problem because if the wordpress theme was working correctly then wouldn't it just over-ride my html landing page?

  10. Patrick Orr
    Member
    Posted 3 years ago #

    Maybe it might help to see my mark-up:

    header.php:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    <meta http-equiv="content-type" content="<?php bloginfo('html_type') ?>; charset=<?php bloginfo('charset') ?>" />
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" title="no title" charset="utf-8" />
    <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css" media="screen" title="no title" charset="utf-8" />
    <link rel="stylesheet" href="css/template.css" type="text/css" media="screen" title="no title" charset="utf-8" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="js/cufon.js"></script>
    <script type="text/javascript" src="js/Prokyon.font.js"></script>
    <script src="js/jquery.validationEngine-en.js" type="text/javascript"></script>
    <script src="js/jquery.validationEngine.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://downloads.mailchimp.com/js/jquery.validate.js"></script>
    <script type="text/javascript" src="http://downloads.mailchimp.com/js/jquery.form.js"></script>
    <script type="text/javascript" src="iepngfix_tilebg.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
          $('.navup').hover(function() {
            $(this).addClass('navover');
            }, function() {
            $(this).removeClass('navover');
        });
    });
    Cufon.replace('p.nav', {
        textShadow: '1px 2px black',
    });
     $(function(){
         var path = location.pathname.substring(1);
        if ( path )
        $('#nav a[href$="' + path + '"]').attr('class', 'selected');
    });
    
    </script>
    
    </head>
    <body>
        	<div id="header">
            	<div id="headerleft">
                	<div><img src="images/header/spacer.gif" width="1px" height="25px" alt="#" /></div>
                    <div id="headergreeting"><p>Welcome to Clementine and Clover!</p></div>
                    <div id="navleft"></div>
                    <div id="nav">
                                <div class="navup"><p class="nav"><a href="#">ABOUT</a></p></div>
                                <div class="navup"><p class="nav"><a href="#">BLOG</a></p></div>
                                <div class="navup"><p class="nav"><a href="#">FEATURED</a></p></div>
                                <div class="navup"><p class="nav"><a href="#">CATALOG</a></p></div>
                                <div class="navup"><p class="nav"><a href="#">ORDER INFO</a></p></div>
                                <div class="navup"><p class="nav"><a href="#">CONTACT</a></p></div>
                    </div>
                </div>
                <div id="headerright">
                	<div id="headerlogo"><a href="http://www.clementineandclover.ca/"></a></div>
                </div>
                <div class="clear"></div>
            </div>

    index.php:

    <?php /* Template Name: Homepage */?>
    
    <?php get_header(); ?>
    <link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="css/nivo-slider.css" type="text/css" media="screen" />
    <script type="text/javascript" src="js/jquery.nivo.slider.pack.js"></script>
    <script type="text/javascript">
    	$(window).load(function() {
    		$('#homepagesides').nivoSlider();
    	});
    </script>
    
    <div id="promowrapper">
        <div id="homepagesider" class="nivoSlider">
             <a href="#"><img class="homepageslides" src="/images/690x290_promo1.jpg" alt="" /></a>
        </div>
    	<div id="homepagepromo">
            <ul>
                <li class="promo1"><a href="#"></a></li>
                <li class="promo2"><a href="#"></a></li>
                <li class="promo3"><a href="#"></a></li>
            </ul>
    	</div>
    </div>
    <?php get_footer(); ?>

    footer.php

    </body>
    </html>
  11. Digital Raindrops
    Member
    Posted 3 years ago #

    Hi,
    Are you developing the theme local and then uploading it?

    As you say if the install was correct then the site would load the wordpress index.php in the WordPress root folder.

    Option 1
    Download the WordPress install again and upload (overwrite) all the fies via ftp, except the wp-contents folder and subfolders.
    Or from admin re-install WordPress.

    Rename your holding html page and see what messages you get, once the install returns your site with the twenty ten theme, then you can proceed.

    Option 2
    Another good practice option, is to upload WordPress to a folder in the website root, and create a staging and testing site to run alongside.

    Create a new testing database, create a new folder say staging in the root directory, ftp the WordPress installation files to the new folder, then logon via your website url plus /staging/

    Go through the install and check the default theme, you will then be able to test out your changes.

    HTH

    David

  12. Patrick Orr
    Member
    Posted 3 years ago #

    David,
    Thanks for all your help and patience. I installed everything over again(I had done this a couple times already. It appears that the 2010 theme was working fine once I deleted my index.html file from the root.

    The problem was that I was trying to navigate directly to the index.php file in the theme folder to test the site.

    I think I need to create a test folder with all the wordpress stuff in it and keep it contained and just work from a subdirectory.

    Can I just make new folder like:
    httpdocs>wordpress>move all files here

    Or do I need to actually install wordpress again?

  13. Digital Raindrops
    Member
    Posted 3 years ago #

    If it is a live site, I would leave it with your holding page in place for now!

    Ceate another new database and upload the wordpress files via ftp to a new folder, and install another WordPress, just use this for on-going testing and development, it is always good to have a site running alongside.

    Google or search this forum for moving your WordPress to a subfolder, if that is the prefered route!

    HTH

    David

  14. Patrick Orr
    Member
    Posted 3 years ago #

    Thanks for working through this with me david. It's people like you that make the world go round! If I could grab you a beer sometime I would.

    Cheers

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.