• Hi there

    I’m getting this message:

    Fatal error: Cannot redeclare omega_theme_setup() (previously declared in /home4/pmcg911/public_html/bibliophone.com/wp-content/themes/omega-child/functions.php:16) in /home4/pmcg911/public_html/bibliophone.com/wp-content/themes/omega/functions.php on line 77

    when I enter this code into my child theme functions.php file:

    remove_action( 'omega_before_header', 'omega_get_primary_menu' );
            add_action( 'omega_after_header', 'omega_get_primary_menu' );

    In fact I get some kind of fatal error every time I try to make changes to the functions file. My functions.php file looks like this:

    <?php
    /* Load Omega theme framework. */
    require ( trailingslashit( get_template_directory() ) . 'lib/framework.php' );
    new Omega();
    
    /**
     * Sets up theme defaults and registers support for various WordPress features.
     *
     * Note that this function is hooked into the after_setup_theme hook, which runs
     * before the init hook. The init hook is too late for some features, such as indicating
     * support post thumbnails.
     */
    function omega_theme_setup() {
    
    	/* Load omega functions */
    	require get_template_directory() . '/lib/hooks.php';
    
            remove_action( 'omega_before_header', 'omega_get_primary_menu' );
            add_action( 'omega_after_header', 'omega_get_primary_menu' );
    
    	/* The best thumbnail/image script ever. */
    	add_theme_support( 'get-the-image' );
    
    	/* Load scripts. */
    	add_theme_support(
    		'omega-scripts',
    		array( 'comment-reply' )
    	);
    
    	add_theme_support( 'omega-theme-settings' );
    
    	add_theme_support( 'omega-content-archives' );
    
    	/* Enable custom template hierarchy. */
    	//add_theme_support( 'omega-template-hierarchy' );
    
    	/* Enable theme layouts (need to add stylesheet support). */
    	add_theme_support(
    		'theme-layouts',
    		array(
    			'1c'        => __( 'Content',           'omega' ),
    			'2c-l'      => __( 'Content / Sidebar', 'omega' ),
    			'2c-r'      => __( 'Sidebar / Content', 'omega' )
    		),
    		array( 'default' => is_rtl() ? '2c-r' :'2c-l', 'customize' => true )
    	);
    
    	/* implement editor styling, so as to make the editor content match the resulting post output in the theme. */
    	add_editor_style();
    
    	/* Support pagination instead of prev/next links. */
    	add_theme_support( 'loop-pagination' );	
    
    	/* Better captions for themes to style. */
    	add_theme_support( 'cleaner-caption' );
    
    	/* Add default posts and comments RSS feed links to <head>.  */
    	add_theme_support( 'automatic-feed-links' );
    
    	/* Enable wraps */
    	add_theme_support( 'omega-wraps' );
    
    	/* Enable custom post */
    	add_theme_support( 'omega-custom-post' );
    
    	/* Enable custom css */
    	add_theme_support( 'omega-custom-css' );
    
    	/* Enable custom logo */
    	add_theme_support( 'omega-custom-logo' );
    
    	/* Enable child themes page */
    	add_theme_support( 'omega-child-page' );
    
    	/* Handle content width for embeds and images. */
    	omega_set_content_width( 640 );
    
    }
    
    add_action( 'after_setup_theme', 'omega_theme_setup' );

    (that’s with the new code added)

    Am I doing something wrong? I often find that if I try to change something in my child theme, it doesn’t get overriden.

    Thanks for your help

    Paul

Viewing 16 replies (of 16 total)
  • There’s something that’s not right with that file then. If that is all that you have in the file, there’s no coding issues and nothing that could cause that error. The only thing that I can suggest would be to go back and try to remove any white space from the file, and make sure that there’s nothing at all after the last closing } for your function.

Viewing 16 replies (of 16 total)
  • The topic ‘Fatal error: Cannot redeclare’ is closed to new replies.