Digital experiences for all disciplines
New Landing › How can we help? › Atelier › child-theme problem
New Landing › How can we help? › Atelier › child-theme problem
- This topic has 9 replies, 4 voices, and was last updated 9 years by Rui Guerreiro – SUPPORT.
-
Posted in: Atelier
-
September 24, 2015 at 4:52 pm #216243
Hi I want to modify the core file here theme/swift-framework/core/sf-header.php and I put the same location/folder into child-theme. but it doesn’t work! same way I modified header file on template-parts/header. that worked. and it would be great if you give option on top bar to add multiple option like header left/right config. right now top-bar only have one option to add . like now I can only add account on topbar right. I want to add account,social,search too. another question there should be inline search form option too.
September 24, 2015 at 4:55 pm #216247Hi,
Do not copy the whole structure and file path.
You just the need to copy the function you are trying to modify into the child theme
functions.php
file.– David.
September 24, 2015 at 5:16 pm #216257I want to change this
`<div class=”container fw-header”>
<?php } else { ?>
<div class=”container”>
<?php } ?>
<div class=”col-sm-4 tb-left”><?php echo $tb_left_output; ?></div>
<div class=”col-sm-4 tb-left”>FREE STANDARD SHIPPING ON ORDERS OVER $300</div>
<div class=”col-sm-4 tb-right”><?php echo $header_right_output; ?></div>
</div>
</div>`
how to do this?September 24, 2015 at 5:28 pm #216261Hi,
You should copy the entire function where that html you want to change exist.
In this case will be the function sf_header_wrap()Copy the entire code to the functions.php of the child theme like David advised, and do your changes there.
/* HEADER WRAP ================================================== */ if ( ! function_exists( 'sf_header_wrap' )) { function sf_header_wrap($header_layout) { global $post, $sf_options; $page_classes = sf_page_classes(); $header_layout = $page_classes['header-layout']; $page_header_type = "standard"; if ( is_page() && $post ) { $page_header_type = sf_get_post_meta( $post->ID, 'sf_page_header_type', true ); } else if ( is_singular( 'post' ) && $post ) { $post_header_type = sf_get_post_meta( $post->ID, 'sf_page_header_type', true ); $fw_media_display = sf_get_post_meta( $post->ID, 'sf_fw_media_display', true ); $page_title_style = sf_get_post_meta( $post->ID, 'sf_page_title_style', true ); if ( $page_title_style == "fancy" || $fw_media_display == "fw-media-title" || $fw_media_display == "fw-media" ) { $page_header_type = $post_header_type; } } else if (is_singular('portfolio') && $post) { $port_header_type = sf_get_post_meta($post->ID, 'sf_page_header_type', true); $fw_media_display = sf_get_post_meta($post->ID, 'sf_fw_media_display', true); $page_title = sf_get_post_meta($post->ID, 'sf_page_title', true); $page_title_style = sf_get_post_meta($post->ID, 'sf_page_title_style', true); if ($page_title_style == "fancy" || !$page_title) { $page_header_type = $port_header_type; } } $fullwidth_header = $sf_options['fullwidth_header']; $enable_tb = $sf_options['enable_tb']; $tb_left_config = $sf_options['tb_left_config']; $tb_right_config = $sf_options['tb_right_config']; $tb_left_text = __($sf_options['tb_left_text'], 'swiftframework'); $tb_right_text = __($sf_options['tb_right_text'], 'swiftframework'); $enable_sticky_tb = false; if ( isset( $sf_options['enable_sticky_topbar'] ) ) { $enable_sticky_tb = $sf_options['enable_sticky_topbar']; } $header_left_config = $sf_options['header_left_config']; $header_right_config = $sf_options['header_right_config']; if ( ( $page_header_type == "naked-light" || $page_header_type == "naked-dark" ) && ( $header_layout == "header-vert" || $header_layout == "header-vert-right" ) ) { $header_layout = apply_filters( 'sf_naked_default_header', "header-1" ); $enable_tb = false; } $tb_left_output = $tb_right_output = ""; if ( $tb_left_config == "social" ) { $tb_left_output .= do_shortcode( '[social]' ) . "\n"; } else if ( $tb_left_config == "aux-links" ) { $tb_left_output .= sf_aux_links( 'tb-menu', true, 'header-1' ) . "\n"; } else if ( $tb_left_config == "menu" ) { $tb_left_output .= sf_top_bar_menu() . "\n"; } else if ($tb_left_config == "cart-wishlist") { $tb_left_output .= '<div class="aux-item aux-cart-wishlist"><nav class="std-menu cart-wishlist"><ul class="menu">'. "\n"; $tb_left_output .= sf_get_cart(); $tb_left_output .= sf_get_wishlist(); $tb_left_output .= '</ul></nav></div>'. "\n"; } else { $tb_left_output .= '<div class="tb-text">' . do_shortcode( $tb_left_text ) . '</div>' . "\n"; } if ( $tb_right_config == "social" ) { $tb_right_output .= do_shortcode( '[social]' ) . "\n"; } else if ( $tb_right_config == "aux-links" ) { $tb_right_output .= sf_aux_links( 'tb-menu', true, 'header-1' ) . "\n"; } else if ( $tb_right_config == "menu" ) { $tb_right_output .= sf_top_bar_menu() . "\n"; } else if ($tb_right_config == "cart-wishlist") { $tb_right_output .= '<div class="aux-item aux-cart-wishlist"><nav class="std-menu cart-wishlist"><ul class="menu">'. "\n"; $tb_right_output .= sf_get_cart(); $tb_right_output .= sf_get_wishlist(); $tb_right_output .= '</ul></nav></div>'. "\n"; } else { $tb_right_output .= '<div class="tb-text">' . do_shortcode( $tb_right_text ) . '</div>' . "\n"; } $top_bar_class = ""; if ($enable_sticky_tb) { $top_bar_class = "sticky-top-bar"; } ?> <?php if ($enable_tb) { ?> <!--// TOP BAR //--> <div id="top-bar" class="<?php echo $top_bar_class; ?>"> <?php if ($fullwidth_header) { ?> <div class="container fw-header"> <?php } else { ?> <div class="container"> <?php } ?> <div class="col-sm-6 tb-left"><?php echo $tb_left_output; ?></div> <div class="col-sm-6 tb-right"><?php echo $tb_right_output; ?></div> </div> </div> <?php } ?> <!--// HEADER //--> <div class="header-wrap <?php echo esc_attr($page_classes['header-wrap']); ?> page-header-<?php echo esc_attr($page_header_type); ?>"> <?php do_action('sf_before_header_section'); ?> <div id="header-section" class="<?php echo esc_attr($header_layout); ?> <?php echo esc_attr($page_classes['logo']); ?>"> <?php do_action('sf_header_section_start'); ?> <?php echo sf_header( $header_layout ); ?> <?php do_action('sf_header_section_end'); ?> </div> <?php do_action('sf_after_header_section'); ?> <?php // Overlay Menu if ( $header_left_config == "overlay-menu" || $header_right_config == "overlay-menu" ) { echo sf_overlay_menu(); } ?> <?php // Contact Slideout if ( $header_left_config == "contact" || $header_right_config == "contact" ) { echo sf_contact_slideout(); } ?> </div> <?php } add_action( 'sf_container_start', 'sf_header_wrap', 20 ); }
Hope it helps.
-Rui
September 24, 2015 at 5:32 pm #216264Hi,
That looks like the function
sf_header_wrap()
.Line 57 – 186 is the whole function: here it is copied out for you: http://pastie.org/private/yqdmczmnox80wnmjimng.
Copy the entire function and place it within your child theme
functions.php
file.– David.
September 24, 2015 at 7:34 pm #216302Okay did it and work half.!! I just put this code
<div class="col-sm-4 tb-right"><?php echo $header_right_output; ?></div>
but it doesn’t seems to be working. on the browser its empty like this.
<div class="col-sm-4 tb-right"></div>
September 24, 2015 at 8:23 pm #216311Okay Make it clear for you. I want to show my top bar like this. Please help me how can i do it.
Attachments:
You must be logged in to view attached files.September 25, 2015 at 8:28 am #216372If all you did was add
<div class="col-sm-4 tb-left">FREE STANDARD SHIPPING ON ORDERS OVER $300</div>
in between it should work fine
– Kyle
September 25, 2015 at 5:13 pm #216539No! It doesn’t works as this
<?php echo $tb_left_output; ?>
only allow one option like if I want to show account then it shows account only I can’t show up account,cart, search( there is no search option available right now for topbar but I need this ) . but I want to show this way.! seems like you need to add option like header area to input multiple option on both sides.September 28, 2015 at 7:34 pm #216999Can you try this settings?
https://www.dropbox.com/s/u9yzpoud0o8olkm/Screenshot%202015-09-28%2019.35.43.png?dl=0but only work if you use header 1, 6 or 8
-Rui
-
Posted in: Atelier
You must be logged in and have valid license to reply to this topic.