• Resolved Chris

    (@christof15)


    Hi there, is there a good way to remove the built in fancybox by overriding the child themes functions.php?

    This is the code from the original functions.php that calls for the fancybox:

    /**
     * Enqueue scripts (and related stylesheets)
     *
     */
    function origin_scripts() {
    
    	if ( !is_admin() ) {
    
    		/* Enqueue Scripts */
    
    		wp_register_script( 'origin_fancybox', get_template_directory_uri() . '/js/fancybox/jquery.fancybox-1.3.4.pack.js', array( 'jquery' ), '1.0', true );
    		wp_enqueue_script( 'origin_fancybox' );
    
    		wp_register_script( 'origin_fitvids', get_template_directory_uri() . '/js/fitvids/jquery.fitvids.js', array( 'jquery' ), '1.0', true );
    		wp_enqueue_script( 'origin_fitvids' );
    
    		wp_register_script( 'origin_footer-scripts', get_template_directory_uri() . '/js/footer-scripts.js', array( 'jquery', 'origin_fitvids', 'origin_fancybox' ), '1.0', true );
    		wp_enqueue_script( 'origin_footer-scripts' );
    
    		wp_enqueue_script( 'origin_navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20130228', true );		
    
    		/* Enqueue Styles */
    		wp_enqueue_style( 'origin_fancybox-stylesheet', get_template_directory_uri() . '/js/fancybox/jquery.fancybox-1.3.4.css', false, 1.0, 'screen' );
    	}
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • I did almost the same thing. I removed the feature cleaner-gallery since it seems that it made the galleries from jetpack to fail. I also did remove the fancybox origin code like this.

    add_action( 'after_setup_theme', 'remove_features_from_origin', 11 );
    add_action( 'wp_print_styles', 'remove_css_scripts_from_origin', 100);
    
    function remove_features_from_origin() {
        remove_theme_support( 'cleaner-gallery' );
    }
    
    function remove_css_scripts_from_origin(){
        wp_dequeue_script( 'origin_fancybox' );
        wp_deregister_script( 'origin_fancybox' );
    
        wp_dequeue_style( 'origin_fancybox-stylesheet' );
        wp_deregister_style( 'origin_fancybox-stylesheet' );
    }
    Thread Starter Chris

    (@christof15)

    Thanks that worked like a charme!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Remove-override fancybox’ is closed to new replies.