Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Dante › Replace sf-header with Child theme
New Landing › How can we help? › Themeforest Theme Support › Dante › Replace sf-header with Child theme
- This topic has 11 replies, 6 voices, and was last updated 8 years by David Martin – Support.
-
Posted in: Dante
-
May 28, 2014 at 3:04 pm #78284
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
May 29, 2014 at 6:10 am #78444Hi,
Please remove your code and use this one code :
require_once(SF_INCLUDES_PATH . '/sf-header.php');
Thanks ๐
With Best Regards
Swift IdeasJune 11, 2015 at 1:02 pm #183602Hi 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
June 11, 2015 at 1:24 pm #183608Hi,
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
MohammadJune 11, 2015 at 1:27 pm #183610Can 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.
June 11, 2015 at 1:56 pm #183624Hi
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
June 11, 2015 at 2:16 pm #183635just copy & paste the whole function and your done, thats really easy going stuff.
thx so much ๐
June 11, 2015 at 2:18 pm #183638No problem
January 25, 2016 at 10:38 pm #243606I 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.
January 26, 2016 at 11:06 am #243685@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.
January 26, 2016 at 6:59 pm #243870So 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
January 26, 2016 at 7:11 pm #243872From the sound of it, the function you need is
sf_logo()
which is located within the filesf-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; } }
-
Posted in: Dante
You must be logged in and have valid license to reply to this topic.