• Resolved steadi22

    (@steadi22)


    Hello, while building my site I did some modifies to functions.php file.
    I think not to have installed child theme.
    Now I see an available upgrade to blocksy theme: will I lose modifies if I upgrade?

    Please, how can I do to upgrade correctly? Am I yet in time to install child theme before upgrading?

    Many thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author creativethemeshq

    (@creativethemeshq)

    Hello @steadi22,
    Yes, if you will upgrade the theme you will lose your modifications added in the functions.php file, this is a normal WordPress thing.

    You can download and install the child theme, then copy all your modifications from the functions.php file of your parent theme and paste them in the child theme functions.php file.

    Let us know if this helps.

    Thread Starter steadi22

    (@steadi22)

    Hello, I tried what you said me.

    First, I activated child theme. Then I used CUSTOMIZER EXPORT/IMPORT plugin
    https://www.ads-software.com/plugins/customizer-export-import/
    following the steps to export customizations and import them to child theme.

    Many of the costumizations however, I have to do it manually (color palettes, symbols etc.).

    This is my blocksy-child functions.php file: from line 10 I copied the “blocksy parent theme” functions.php file.
    But in this way the website goes down and I visualize CRITICAL ERROR ON YOUR WORDPRESS SITE. How can I do?

    <?php
    if (! defined('WP_DEBUG')) {
    	die( 'Direct access forbidden.' );
    }
    add_action( 'wp_enqueue_scripts', function () {
    	wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    });
    add_action( 'wp_enqueue_scripts', function () {
    	wp_enqueue_style('blocksy-child-style', get_stylesheet_uri());
    /**
     * Blocksy functions and definitions
     *
     * @link https://developer.www.ads-software.com/themes/basics/theme-functions/
     *
     * @package Blocksy
     */	
    	
    	
    // Remove the product description Title
    add_filter( 'woocommerce_product_description_heading', '__return_null' );
    
    if ( version_compare( PHP_VERSION, '5.7.0', '<' ) ) {
    	require get_template_directory() . '/inc/php-fallback.php';
    	return;
    }
    
    require get_template_directory() . '/inc/init.php';
    
    /**
     * Change text strings
     *
     * @link https://codex.www.ads-software.com/Plugin_API/Filter_Reference/gettext
     */
    function my_text_strings( $translated_text, $text, $domain ) {
    	switch ( $translated_text ) {
    		case 'Prev' :
    			$translated_text = __( 'precedente', 'woocommerce' );
    			break;
    			
    				case 'Next' :
    			$translated_text = __( 'successivo', 'woocommerce' );
    			break;
    			
    				case 'out of stock' :
    			$translated_text = __( 'esaurito', 'woocommerce' );
    			break;
    									
    	}
    	return $translated_text;
    	
    }
    add_filter( 'gettext', 'my_text_strings', 20, 3 );
    
    add_action( 'woocommerce_checkout_process', 'wpspecial_imposta_ordine_minimo_importo' );
    add_action( 'woocommerce_before_cart' , 'wpspecial_imposta_ordine_minimo_importo' ); 
    add_action( 'woocommerce_before_checkout_form', 'wpspecial_imposta_ordine_minimo_importo' );
    function wpspecial_imposta_ordine_minimo_importo() {
        // Specifica l'importo minimo per l'acquisto
        $minimo_acquisto = 20;
    
        if ( WC()->cart->total < $minimo_acquisto ) {
    
            if( is_cart() ) {
    
                wc_print_notice( 
                    sprintf( 'Devi effettuare un acquisto minimo di %s per completare un ordine, attualmente il tuo ordine è di %s.' , 
                        wc_price( $minimo_acquisto ), 
                        wc_price( WC()->cart->total )
                    ), 'error' 
                );
    
            } else {
    
                wc_add_notice( 
                    sprintf( 'Devi effettuare un acquisto minimo di %s per completare un ordine, attualmente il tuo ordine è di %s.' , 
                        wc_price( $minimo_acquisto ), 
                        wc_price( WC()->cart->total )
                    ), 'error' 
                );
    
            }
        }
    }
    
    add_filter('blocksy-child:breadcrumbs:items-array', function ($items) {
    	if (get_post_type() === 'mod_services') {
    		$items = array_merge(
    			array_slice($items, 0, 1),
    
    			// Add services after Home item
    			[
    				[
    					'name' => 'Services',
    					'url' => home_url('/services')
    				]
    			],
    
    			array_slice($items, 1)
    		);
    	}
    
    	return $items;	
    	
    });	
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Modifies on parent theme’ is closed to new replies.