ThemeShaper Forums » Thematic

Fatal Error when completing header.php document

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

    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 4 years ago #
  2. justkeepblogging
    Member

    Here is the code from my 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(); ?>>
    <head profile="http://gmpg.org/xfn/11">
    <title><?php
    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(); }
    ?></title>

    <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'); ?>" />
    </head>
    <body>
    <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="http://gmpg.org/xfn/11">

    <?php

    thematic_doctitle();
    thematic_create_contenttype();
    thematic_show_description();
    thematic_show_robots();
    thematic_canonical_url();
    thematic_create_stylesheet();
    thematic_show_rss();
    thematic_show_commentsrss();
    thematic_show_pingback();
    thematic_show_commentreply();

    wp_head(); ?>

    </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 4 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 4 years ago #
  4. justkeepblogging
    Member

    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 :

    http://themeshaper.com/wordpress-theme-development-tools-tutorial/

    For the code you quoted, should I delete it?

    Mary

    Posted 4 years ago #
  5. justkeepblogging
    Member

    I think I may know why this occurred.

    Posted 4 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.

    -Gene

    Posted 4 years ago #
  7. justkeepblogging
    Member

    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 4 years ago #

RSS feed for this topic

Reply

You must log in to post.