badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

Over the conditions for prohibition "require_once" in functions.php

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15981
    Pavel
    Participant

    The template file header-extensions.php need to edit that part load menu. I want to make a child theme. I copied this file to the child, including directories (inc / structure) and to the child functions.php file I put require_once (get_stylesheet_directory (). ‘/inc/structure/header-Extensions.php’) ;.
    This, however, has an error “Can not redeclare”. I understand that the “template child” reads the header first and second template. Is there any way to disable functions in the template condition, this “require_once (INTERFACE_STRUCTURE_DIR. ‘/header-Extensions.php’);” ?

    #15996

    Hi Pavel,

    Just create a childtheme and create just a functions.php file only. First you need to unhook the functions and then only hook it.

    for example to unhook functions

    unhook functions
    
    // Unhook default Thematic functions
    function unhook_thematic_functions() {
        // Don't forget the position number if the original function has one
    
    remove_action('interface_init', 'interface_load_files', 15);
    
    }
    add_action('init','unhook_thematic_functions'); // removes the header content by using hook attitude_header
    
    add_action( 'interface_init', 'interface_child_init', 15);
    
     
    function interface_child_init() {    
    /** 
    	 * interface_add_files hook
    	 *
    	 * Adding other addtional files if needed.
    	 */
    	do_action( 'interface_add_files' );
    
    	/** Load functions */
    	require_once( INTERFACE_FUNCTIONS_DIR . '/i18n.php' );
    	require_once( INTERFACE_FUNCTIONS_DIR . '/custom-header.php' );
    	require_once( INTERFACE_FUNCTIONS_DIR . '/functions.php' );
    	require_once( INTERFACE_FUNCTIONS_DIR . '/custom-style.php' );
    	require_once( INTERFACE_ADMIN_DIR . '/interface-themedefaults-value.php' );
    	require_once( INTERFACE_ADMIN_DIR . '/theme-option.php' );
    	require_once( INTERFACE_ADMIN_DIR . '/interface-metaboxes.php' );
    	require_once( INTERFACE_ADMIN_DIR . '/interface-custom-post-types.php' );
    	
    
    	/** Load Shortcodes */
    	require_once( INTERFACE_SHORTCODES_DIR . '/interface-shortcodes.php' );
    
    	/** Load Structure */
    	require_once( INTERFACE_STRUCTURE_DIR . '/searchform-extensions.php' );
    	require_once( INTERFACE_STRUCTURE_DIR . '/sidebar-extensions.php' );
    	require_once( INTERFACE_STRUCTURE_DIR . '/footer-extensions.php' );
    	require_once( INTERFACE_STRUCTURE_DIR . '/content-extensions.php' );
    
    	/** Load Widgets and Widgetized Area */
    	require_once( INTERFACE_WIDGETS_DIR . '/interface_widgets.php' );
    	
    	/** Fuction to help install the plugin from within the theme */
    	require_once( INTERFACE_FUNCTIONS_DIR . '/class-tgm-plugin-activation.php' );
    	require_once( INTERFACE_FUNCTIONS_DIR . '/activate-plugin.php' );
    }

    Hope this may help you

    Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.