New Landing How can we help? Themeforest Theme Support Dante Replace sf-header with Child theme

Viewing 12 posts - 1 through 12 (of 12 total)
  • Posted in: Dante
  • #78284
    HEPA
    Member
    Post count: 10

    Hi

    I would like to modify the file sf-header.php

    I have created a functions.php which I added inside my child folder, but I am doing something wrong, as I am breaking the site.

    What i add inside functions.php is

    <?php
    	if (!function_exists('sf_custom_content')) {
    		function sf_custom_content_functions() {
    			include_once(SF_INCLUDES_PATH . '/sf-header.php');
    			}
    		add_action('init', 'sf_custom_content_functions', 0);
    	}
    	
    ?>
    

    What is the right way to do it?

    thanks

    #78444
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please remove your code and use this one code :
    require_once(SF_INCLUDES_PATH . '/sf-header.php');
    Thanks ๐Ÿ™‚
    With Best Regards
    Swift Ideas

    #183602
    t4_bicaj
    Member
    Post count: 3

    Hi Mohammad,

    I have the same issue with my child theme, but your code won’t either work..

    require_once(SF_INCLUDES_PATH . ‘/sf-header.php’);

    Do I have to upload more files except sf-header.php to my child theme?

    I createt exact the same path like in dante (includes/sf-header.php) in the childtheme and added your code, but all i get is a blank page.

    hope you can help me with this.

    thanks

    #183608
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You can override the all functions of sf-header.php file through functions.php file of child theme. Its easy way so just try it out.

    Thanks
    Mohammad

    #183610
    t4_bicaj
    Member
    Post count: 3

    Can you please help me with this? I have no idea how to do this?

    There are no infomations on how to change stuff like this.

    #183624
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    You need to copy the function that you’re changing into the child theme’s functions.php file. They start with somethign similiar to:

    /* TOP BAR
     	================================================== */
     	if (!function_exists('sf_top_bar')) {
    		function sf_top_bar() {

    – Kyle

    #183635
    t4_bicaj
    Member
    Post count: 3

    just copy & paste the whole function and your done, thats really easy going stuff.

    thx so much ๐Ÿ™‚

    #183638
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    No problem

    #243606
    chris_swany
    Member
    Post count: 2

    I am running into the same issue.

    I have added to my child theme functions this code

    	/* CONTENT FUNCTIONS
    	================================================== */
    	if (!function_exists('sf_custom_content')) {
    		function sf_custom_content_functions() {
    			include_once(SF_INCLUDES_PATH . '/sf-header.php');
    			include_once(SF_INCLUDES_PATH . '/sf-page-heading.php');
    			include_once(SF_INCLUDES_PATH . '/sf-blog.php');
    			include_once(SF_INCLUDES_PATH . '/sf-portfolio.php');
    			include_once(SF_INCLUDES_PATH . '/sf-portfolio-detail.php');
    			include_once(SF_INCLUDES_PATH . '/sf-products.php');
    			include_once(SF_INCLUDES_PATH . '/sf-post-formats.php');
    		}
    		add_action('init', 'sf_custom_content_functions', 0);
    	}

    I then added an includes folder and put in those 7 files copied from the parent theme. I did not change anything from those 7 files and I get a 500 error when I load my page now. I have also tried to replace include_once with require_once but same 500 error.

    #243685
    David Martin – Support
    Moderator
    Post count: 20834

    @chris_swany – you do not need that function added to your child theme.

    You only need to copy in the function you are wanting to overwrite. Do not copy the whole file contents.

    Thanks.

    #243870
    chris_swany
    Member
    Post count: 2

    So I am a little confused. All I want to do is add a line of text next to the logo.

    So do I need to just copy the sf_header function and put that into my functions.php file on my child theme and then make my changes to that function?

    Thanks

    #243872
    David Martin – Support
    Moderator
    Post count: 20834

    From the sound of it, the function you need is sf_logo() which is located within the file sf-header.php.

    It looks like this, that is all you’d want to add to the child theme:

    	/* LOGO
    	================================================== */
    	if (!function_exists('sf_logo')) {
    		function sf_logo($logo_class) {
    
    			//VARIABLES
    			global $woocommerce;
    			$options = get_option('sf_dante_options');
    			$show_cart = $options['show_cart'];
    			$logo = $retina_logo = $light_logo = $dark_logo = "";
    			if (isset($options['logo_upload'])) {
    			$logo = __( $options['logo_upload'] , 'swiftframework' );
    			}
    			if (isset($options['retina_logo_upload'])) {
    			$retina_logo = __( $options['retina_logo_upload'] , 'swiftframework' );
    			}
    
    			// Light Logo
    			if (isset($options['light_logo_upload'])) {
    			$light_logo = __( $options['light_logo_upload'] , 'swiftframework' );
    			}
    			if ( $light_logo != "" ) {
    			    $logo_class .= " has-light-logo";
    			}
    
    			// Dark Logo
    			if (isset($options['dark_logo_upload'])) {
    				$dark_logo = __( $options['dark_logo_upload'] , 'swiftframework' );
    			}
    			if ( $dark_logo != "" ) {
    			    $logo_class .= " has-dark-logo";
    			}
    
    			if ($retina_logo == "") {
    			$retina_logo = $logo;
    			}
    
    			$logo_output = "";
    			$logo_alt = get_bloginfo( 'name' );
    			$logo_link_url = home_url();
    
    			// LOGO OUTPUT
    			$logo_output .= '<div id="logo" class="'.$logo_class.' clearfix">'. "\n";
    			$logo_output .= '<a href="'.$logo_link_url.'">'. "\n";
    			if ($logo != "") {
    			$logo_output .= '<img class="standard" src="'.$logo.'" alt="'.$logo_alt.'" />'. "\n";
    			} else {
    			$logo_output .= '<h1 class="standard">'.$logo_alt.'</h1>'. "\n";
    			}
    			if ($retina_logo != "") {
    			$logo_output .= '<img class="retina" src="'.$retina_logo.'" alt="'.$logo_alt.'" />'. "\n";
    			} else {
    			$logo_output .= '<h1 class="retina">'.$logo_alt.'</h1>'. "\n";
    			}
    			if ($light_logo != "") {
    			$logo_output .= '<img class="light-logo" src="'.$light_logo.'" alt="'.$logo_alt.'" />'. "\n";
    			}
    			if ($dark_logo != "") {
    			$logo_output .= '<img class="dark-logo" src="'.$dark_logo.'" alt="'.$logo_alt.'" />'. "\n";
    			}
    			$logo_output .= '</a>'. "\n";
    			$logo_output .= '<a href="#" class="visible-sm visible-xs mobile-menu-show"><i class="ss-rows"></i></a>'. "\n";
    			if ($show_cart && $woocommerce != "") {
    			$logo_output .= '<a href="'.$woocommerce->cart->get_cart_url().'" class="visible-sm visible-xs mobile-cart-link"><i class="ss-cart"></i></a>'. "\n";
    			}
    			$logo_output .= '</div>'. "\n";
    
    			// LOGO RETURN
    			return $logo_output;
    		}
    	}
Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register