• I am using:
    WordPress V 3.3.2
    WP-eCommerce V 3.8.8
    Theme: Twenty Eleven
    Child Theme: Twentyeleven-child
    Web Site: https://www.greenhillsoaps.com

    When I go to the site I get the following message:

    Fatal error: Call to undefined function twentyeleven_content_nav() in /home/fgoldwyn/public_html/www.greenhillsoaps.com/wp-content/themes/twentyeleven-child/index.php on line 23

    I checked my index.php of my child theme and the relevant sections is as follows:

    <div id="primary">
    			<div id="content" role="main">
    
    			<?php if ( have_posts() ) : ?>
    
    				<?php twentyeleven_content_nav( 'nav-above' ); ?>
    
    				<?php /* Start the Loop */ ?>
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php get_template_part( 'content', get_post_format() ); ?>
    
    				<?php endwhile; ?>
    
    				<?php twentyeleven_content_nav( 'nav-below' ); ?>
    
    			<?php else : ?>

    I then checked my Parent theme functions.php and found the function twentyeleven_content_nav () on line 422. That code is as follows:

    add_action( 'widgets_init', 'twentyeleven_widgets_init' );
    
    if ( ! function_exists( 'twentyeleven_content_nav' ) ) :
    /**
     * Display navigation to next/previous pages when applicable
     */
    function twentyeleven_content_nav( $nav_id ) {
    	global $wp_query;
    
    	if ( $wp_query->max_num_pages > 1 ) : ?>
    		<nav id="<?php echo $nav_id; ?>">
    			<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
    			<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyeleven' ) ); ?></div>
    			<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?></div>
    		</nav><!-- #nav-above -->
    	<?php endif;
    }
    endif; // twentyeleven_content_nav

    Both the child theme index.php and the parent theme functions.php are as specified by WordPress.

    The only other change that was made was that I had to replace my robots.tx file. Other than that, there have been no other changes to my site.

    The site was working perfectly yesterday, then this morning – FATAL ERROR.

    My site is down and I cannot find out how to get it back up. I have searched the forum for this error and there are 5, I think, postings, but none explain what to do to fix the problem.

    This is a desperate plea for help.

Viewing 12 replies - 1 through 12 (of 12 total)
  • In your child theme style.css, why do you have 2 blocks setting the theme info?

    /*
    Theme Name:     Twenty Eleven Child
    Theme URI:      http: //greenhillsoaps.com/
    Description:    Child theme for the Twenty Eleven theme
    Author:         Francis Goldwyn
    Author URI:     http: //Greenhillsoaps.com/about/
    Template:       twentyeleven
    Version:        0.1.0
    */
    
    /*
    Theme Name: Twentyeleven Child
    Description: Child theme for the twentyeleven theme
    Author: Francis Goldwyn
    Template: twentyeleven
    */

    I’m not sure if this would cause any issues… but technically you are renaming the theme in itself, since tyhe theme names don’t match. First thing I would try, is picking one or the other and sticking with it

    Thread Starter FGoldwyn

    (@fgoldwyn)

    Rev. Voodo,

    Thanks for the comment.
    I will make that change, but that is not causing the problem.
    the index.php is calling the function twentyeleven_content_nav(). The function exists in the parent theme funtions.php.

    The fatal error message indicates the function is undefined. This does not seem to be the case. I am really confused about this and do not know how to fix it.

    Thread Starter FGoldwyn

    (@fgoldwyn)

    One last comment.

    The error occurs in all browsers.

    Re-upload a fresh copy of Twenty Eleven using FTP or whatever file management application your host provides.
    https://www.ads-software.com/extend/themes/twentyeleven

    Thread Starter FGoldwyn

    (@fgoldwyn)

    Dear esmi,

    I did exactly as you said. I downloaded a fresh version of Twenty Eleven to my hard drive, extracted the files, then used FileZilla to upload to my Twenty Eleven theme folder on my host provider (HostGator).

    I checked that each file was updated, I also checked file sizes for both index.php and functions.php and re-uploaded those files just be be sure.

    I then checked the function for function content_nav() and it is the same as the old file.

    I then opened FireFox and tried to access the website. I got the following error message.

    Fatal error: Call to undefined function twentyeleven_content_nav() in /home/fgoldwyn/public_html/www.greenhillsoaps.com/wp-content/themes/twentyeleven-child/index.php on line 23

    I also went to my root folder and checked my config.php file to make sure the correct database was referenced and it is.

    What else should I try?

    Thanks.

    In my copy of Twenty eleven, twentyeleven_content_nav() is defined on line 428 of functions.php:

    function twentyeleven_content_nav( $nav_id ) {
    	global $wp_query;
    
    	if ( $wp_query->max_num_pages > 1 ) : ?>
    		<nav id="<?php echo $nav_id; ?>">
    			<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
    			<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyeleven' ) ); ?></div>
    			<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?></div>
    		</nav><!-- #nav-above -->
    	<?php endif;
    }

    Can you confirm this in your copy?
    Are you over-riding any parent functions in your child theme?

    as the functions is pluggable, what happens if you paste the code, last posted by @esmi, into functions.php of your child theme?


    the weird thing is that also clicking ‘contact us’ which should use page.php of the parent theme, gives the same error.

    there is something fundamental wrong in your setup.

    there is something fundamental wrong in your setup

    Yup, that’s why I started with that double header in style.css, it seemed odd. Was wondering if that could ‘confuse’ WP

    @fgoldwyn, what is your child theme structure like? What files do you have in there? What changes are you making?

    For instand, your index.php above looks pretty stock, what changes are made that necessitate adding index.php to your child theme?

    Also, what functions do you have going on in your functions.php?

    Thread Starter FGoldwyn

    (@fgoldwyn)

    Dear esmi,alchymyth, and Dr. Voodoo;
    First, I removed the duplicate from my child CSS as per the good Doctors’ advice.
    Second, I uploaded a current version of Twenty Eleven V 1.3.
    Third, I contacted my host (Host Gator) and they looked at the problem as I thought there might be something on their end. They uploaded the Twenty Eleven theme again. They said it was a problem with the theme. I pushed back a bit on this and the technician said the site was working but going to the Parent Theme, not the child theme. I verified this and so it is.

    The code in my current Twenty Eleven functions.php for the _content_nav() is as follows:

    [code moderated - the forum limit for posting code is 10 lines - for anything above, please use the pastebin]

    This is the code from line 424 through 439.

    The code in my index.php is as follows:

    [code moderated - please use the pastebin]

    I do believe this is the right code, but please let me know if you see anything amiss.

    At the moment, the site is up, but using the parent theme. When I inspect the site with firebug, what seems to be happening is the child theme is not loading, only the parent. I am going to reload my child theme, file by file (yes, I have a backup, thank God for small favors).

    In my child theme, I have a functions.php file which contains two functions specific to my child theme. I was advised not to change the parent functions.php file, but to include the functions in a file in the child theme. There has been no problem with this until yesterday. I also have a header.php in my child theme as I customized the header. However, if the child theme is not being read or loaded by the site, then, it would seen unlikely that these files are the issue.

    Thread Starter FGoldwyn

    (@fgoldwyn)

    Well my gentle readers, our intrepid hero has wandered through the darkness and labored mightily. He has been rewarded by the words of the immortal codex once again.

    There was a problem with the theme. esmi the wise, was right to reload the theme. Yet, the child theme was not being loaded. So our hero went to the noble codex and searched for “child theme not loading”. Buried in one of the comments, was the statement: “be sure to activate your theme through your administrative dashboard”. So rushing to his dashboard -> appearance -> themes, there low and behold, Twenty Eleven was not activated and the twentyeleven-child was not showing. So he activated the parent Twenty Eleven, and then the child theme was available. Having struggled through the desperation of a down site, he checked if the child theme needed activation, which it did. So he activated the child theme.

    There was a crack of thunder and a voice spoke out telling our hero to check his web site. He entered the url https://www.greenhillsoaps.com, a light appeared, and the universe was in balance and all is good in the world again.

    So gentle readers, this chapter ends. Rest assured, there will be another chapter in: “The Tortures of a Web Site Owner”.

    Thank you

    *LOL* What a wonderful – and successful – followup!

    Rest assured, there will be another chapter in: “The Tortures of a Web Site Owner”.

    Trust me, we have all been there!!

    I look back on my WP forum history to when I first joined, just for entertainment sometimes…. Education from necessity eh?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Fatal error: Call to undefined function twentyeleven_content_nav()’ is closed to new replies.