ThemeShaper Forums » Thematic

Fatal Error when completing header.php document

(7 posts)
  • Started 12 years ago by justkeepblogging
  • Latest reply from justkeepblogging
  • This topic is resolved
  1. justkeepblogging

    I am working through the customize thematic documents and every time I complete lesson 5 and preview my theme I get the following error:

    Fatal error: Call to undefined function get_page_number() in C:\xampp\htdocs\wordpress\wp-content\themes\thematic\header.php on line 6

    I've checked my code and it looks the way it does in the code posted in Google Code.

    Have I made a mistake or is something that resolves later with more code added to the theme?

    ETA: I copied the header.php code from the Google Code page for thematic into my theme and received the same error when I previewed the theme.

    I am using both the latest versions of WP and thematic.

    Posted 12 years ago #
  2. justkeepblogging

    Here is the code from my header.php:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="" <?php language_attributes(); ?>>
    <head profile="">
    if ( is_single() ) { single_post_title(); }
    elseif ( is_home() || is_front_page() ) { bloginfo('name'); print ' | '; bloginfo('description'); get_page_number(); }
    elseif ( is_page() ) { single_post_title(''); }
    elseif ( is_search() ) { bloginfo('name'); print ' | Search results for ' . wp_specialchars($s); get_page_number(); }
    elseif ( is_404() ) { bloginfo('name'); print ' | Not Found'; }
    else { bloginfo('name'); wp_title('|'); get_page_number(); }

    <meta http-equiv="content-type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

    <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" />

    <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>

    <?php wp_head(); ?>

    <link rel="alternate" type="application/rss+xml" href="<?php bloginfo('rss2_url'); ?>" title="<?php printf( __( '%s latest posts', 'your-theme' ), wp_specialchars( get_bloginfo('name'), 1 ) ); ?>" />
    <link rel="alternate" type="application/rss+xml" href="<?php bloginfo('comments_rss2_url') ?>" title="<?php printf( __( '%s latest comments', 'your-theme' ), wp_specialchars( get_bloginfo('name'), 1 ) ); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <div id="wrapper" class="hfeed">
    <div id="header">
    <div id="masthead">

    <div id="branding">
    <div id="blog-title"><span>/" title="<?php bloginfo( 'name' ) ?>" rel="home"><?php bloginfo( 'name' ) ?></span></div>
    <?php if ( is_home() || is_front_page() ) { ?>
    <h1 id="blog-description"><?php bloginfo( 'description' ) ?></h1>
    <?php } else { ?>
    <div id="blog-description"><?php bloginfo( 'description' ) ?></div>
    <?php } ?>
    </div><!-- #branding -->

    <div id="access">
    <div class="skip-link">"><?php _e( 'Skip to content', 'your-theme' ) ?></div>
    <?php wp_page_menu( 'sort_column=menu_order' ); ?>
    </div><!-- #access -->

    </div><!-- #masthead -->
    </div><!-- #header -->

    <div id="main">

    <?php thematic_create_doctype(); echo " "; language_attributes(); echo ">\n";?>
    <head profile="">



    wp_head(); ?>


    <body class="<?php thematic_body_class() ?>">
    <?php thematic_before(); ?>

    <div id="wrapper" class="hfeed">

    <?php thematic_aboveheader(); ?>

    <div id="header">
    <?php thematic_header() ?>
    </div><!-- #header-->

    <?php thematic_belowheader(); ?>

    <div id="main">

    Posted 12 years ago #
  3. Hi-

    I'm not sure what tutorial you are following so am I missing the point of what you are trying to do entirely. Unless you have defined the function get_page_number() somewhere then you are calling to an undefined function and your code will fail.

    Besides that you are duplicating the same general code twice... the second time begins with <?php thematic_create_doctype(); echo " "; language_attributes(); echo ">\n";

    Hope it helps-Gene

    Posted 12 years ago #
  4. justkeepblogging

    Hi Gene,

    Thanks for your answer.

    I'm doing the Theme Development Tools here on the themehaper site and am getting the error on #5, The Header Template :

    For the code you quoted, should I delete it?


    Posted 12 years ago #
  5. justkeepblogging

    I think I may know why this occurred.

    Posted 12 years ago #
  6. Oh, I see what you're doing now. I'm not sure how to advise you without walking through that tutorial myself. Maybe you should try and backtrack trough the tut and see if you missed anything?

    My first question would be: are you starting a theme from scratch or are you working the tutorial using a theme thats already been created. That would explain the duplicate efforts in the code you posted above. I believe that you should be approaching that tutorial by creating all new files not overwriting an existing theme.

    Secondly have you added the get_page_number() function from the tutorial into your functions.php ?

    And thirdly have you actually activated the child theme that houses the functions.php that you are editing.

    Beyond that.. It sounds like you've got a handle on it. Keep trying and you'll figure it out.


    Posted 12 years ago #
  7. justkeepblogging

    Hey Gene,

    I think I confused the tutorial with customizing thematic, so that does explain the duplicate code. That tutorial I see now is for creating a theme from scratch and has nothing to do with the thematic theme, if I understand correctly. I won't be working on that anymore and will be customizing the thematic theme.

    I'm just a beginner and I've read through all the documentation and am trying to figure out just how I go about customizing thematic using the child theme. It is confusing, but once I figure that out I'll be okay.

    I will be asking a lot of very basic beginner questions!

    Posted 12 years ago #

RSS feed for this topic


You must log in to post.