-
level200Participant
ahh I see Daniel. I copied over the whole functions.php and it broke the site. how would I go about adding the changes to the child without the functions.php?
Daniel TaraKeymasterThe child theme’s functions.php file is loaded before the parent theme’s functions.php file. You need to copy just the functions that you modified and without the
if( function_exists( '...' ) ) :
,endif;
andadd_action( '...' );
statements.Daniel TaraKeymasterHere’s an example of how a function looks like in functions.php:
if ( ! function_exists( 'pinboard_filter_query' ) ) : /** * Filter the main loop * * Allows overriding of query parameters * for the main loop without performing * additional database queries * * @since Pinboard 1.0 */ function pinboard_filter_query( $query ) { global $wp_the_query; if( $wp_the_query === $query ) { if( $query->is_home() && pinboard_get_option( 'slider' ) ) $query->set( 'ignore_sticky_posts', 1 ); if( $query->is_home() && pinboard_get_option( 'blog_exclude_portfolio' ) ) $query->set( 'cat', '-' . pinboard_get_option( 'portfolio_cat' ) ); } } endif; add_action( 'pre_get_posts', 'pinboard_filter_query' );
This is how you should copy it in the child theme’s functions.php:
function pinboard_filter_query( $query ) { global $wp_the_query; if( $wp_the_query === $query ) { if( $query->is_home() && pinboard_get_option( 'slider' ) ) $query->set( 'ignore_sticky_posts', 1 ); if( $query->is_home() && pinboard_get_option( 'blog_exclude_portfolio' ) ) $query->set( 'cat', '-' . pinboard_get_option( 'portfolio_cat' ) ); } }
level200ParticipantThanks for making that clear Daniel, I’m using this with a child theme now.
One other thing I noticed since updating Pinboard. The product image Lightbox has stopped working and lost the Add to cart button for one product, This has only happened since updating pinboard. Is this to do with the update somehow?
Product: http://www.northernwild.co.uk/index.php/product/test-print/#reset
Cheers
John- This reply was modified 10 years, 5 months ago by level200.
level200ParticipantAfter researching the possible problem, it seems to be coming from the theme.
Possible issues here: https://github.com/woothemes/woocommerce/issues/1074
Any thoughts Daniel?
Daniel TaraKeymasterApparently it is caused by the latest version of the FlexSlider script. I’ll have to look more into it and let you know when it’s fixed.
level200ParticipantAre you still working on this Daniel? I have noticed a few changes and was wondering if its ok to re add my child function and style changes as they seem to have vanished.
Cheers
JohnDaniel TaraKeymasterYes, there is more than one issue I’m working on. It will probably be released the following days, I’ll let you know.
level200ParticipantHi Daniel
Updated theme is working great thanks. I’m just reapplying functions and styles to the child theme.
I’m having a problem with the child themes functions.php. I want to add the following code but the child function doesn’t seem to like it. The suggested code change that you mentioned for child function pages doesn’t seem to work with this sort of filter. Any suggestions?
add_filter( ‘woocommerce_product_tabs’, ‘woo_remove_product_tabs’, 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs[‘description’] ); // Remove the description tab
unset( $tabs[‘reviews’] ); // Remove the reviews tab
unset( $tabs[‘additional_information’] ); // Remove the additional information tabreturn $tabs;
}
ouzolinyParticipantHi Daniel, #level200,
I am struggling to make the wrapping work. I followed the manual posted here however I cannot seem to make it work.
I am using a child theme of pinboard, created a new function.php in the child theme directory and put the following code in:
<?php remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10); add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10); function my_theme_wrapper_start() { echo '<section id="container">'; } function my_theme_wrapper_end() { echo '</section>'; } ?>
This did not help. I tried to use “content” id instead of “container”, which made the side bar appear correctly, however, the products are now aligned on the far right of the page (as if within the right sidebar, which I am not using), while leaving the center content blank:
I have also tried to use the “full length” template for product page, but it left the page with sidebar.
Could you please clarify what exactly should I put into the child function.php?
Thank you in advance, your help would be much appreciated π
Daniel TaraKeymasterThe WooCommerce container should be replaced with the theme’s container, but rather the theme’s container should wrap the WooCommerce container. I think that’s default behavior so the code above is not necessary. What guide are you following? The first result in the link you provided is for a different theme with the same name.
You must be logged in to reply to this topic.