WordPress.org

Ready to get started?Download WordPress

Forums

Catch Box
[resolved] Remove slider.js completely (6 posts)

  1. noearthling
    Member
    Posted 1 year ago #

    Hi,
    I use the Catchbox theme and like it very much. But as I do not use the slider I would like to remove it completely from my website.

    The problem is, that even though I have disabled the slider and it will not show anymore, all its related files and functions are still loaded and slowing down the overall performance.

    Is there any help? For example just by removing the slider.js-file? Or do I have to insert a certain code in the function.php?

    I'd really appreciate your help here. Thank you very much!

  2. Catch Themes
    Member
    Theme Author

    Posted 1 year ago #

    @noearthling: It's pretty simple.
    Go to Theme Options -> Featured Slider -> Slider Options.
    Then in number of slides. Type in 0. This will remove all the ids in the slider and then if the slider doesn't find any ids it will simply be disabled.

  3. noearthling
    Member
    Posted 1 year ago #

    Hi Sakin,
    thank you very much for your answer, but I already did what you said. I disabled the slider by setting the number of slides to 0, so the slider won't show anymore. But the files, e.g. slider.js, are still loaded slowing down the performance. I would like to remove this file from the theme completely without destroying the theme.

    Do you have any suggestions how to do that?

    Thanks in advance.

  4. Catch Themes
    Member
    Theme Author

    Posted 1 year ago #

    @noearthling: in theme fucntion.php you will see the below code:

    /**
     * Register jquery scripts
     *
     * @register jquery cycle and custom-script
     * hooks action wp_enqueue_scripts
     */
    function catchbox_scripts_method() {
    	//Register JQuery circle all and JQuery set up as dependent on Jquery-cycle
    	wp_register_script( 'jquery-cycle', get_template_directory_uri() . '/js/jquery.cycle.all.min.js', array( 'jquery' ), '2.9999.5', true );
    
    	//Enqueue Slider Script only in Front Page
    	if(is_home() || is_front_page()) {
    		wp_enqueue_script( 'catchbox_slider', get_template_directory_uri() . '/js/catchbox_slider.js', array( 'jquery-cycle' ), '1.0', true );
    	}
    
    	wp_enqueue_script('catchbox-menu', get_template_directory_uri() . '/js/catchbox-menu.min.js', array('jquery'), '1.1.0', true);
    
    	//Browser Specific Enqueue Script i.e. for IE 1-6
    	$catchbox_ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    	if(preg_match('/(?i)msie [1-6]/',$catchbox_ua)) {
    		wp_enqueue_script( 'catchbox-pngfix', get_template_directory_uri() . '/js/pngfix.min.js' );
    	}
    	//browser specific queuing i.e. for IE 1-8
    	if(preg_match('/(?i)msie [1-8]/',$catchbox_ua)) {
    	 	wp_enqueue_script( 'catchbox-html5', get_template_directory_uri() . '/js/html5.js' );
    	}
    
    } // catchbox_scripts_method

    Replace this with the following:

    /**
     * Register jquery scripts
     *
     * @register jquery cycle and custom-script
     * hooks action wp_enqueue_scripts
     */
    function catchbox_scripts_method() {
    	/*
    	//Register JQuery circle all and JQuery set up as dependent on Jquery-cycle
    	wp_register_script( 'jquery-cycle', get_template_directory_uri() . '/js/jquery.cycle.all.min.js', array( 'jquery' ), '2.9999.5', true );
    
    	//Enqueue Slider Script only in Front Page
    	if(is_home() || is_front_page()) {
    		wp_enqueue_script( 'catchbox_slider', get_template_directory_uri() . '/js/catchbox_slider.js', array( 'jquery-cycle' ), '1.0', true );
    	}
    	*/
    
    	wp_enqueue_script('catchbox-menu', get_template_directory_uri() . '/js/catchbox-menu.min.js', array('jquery'), '1.1.0', true);
    
    	//Browser Specific Enqueue Script i.e. for IE 1-6
    	$catchbox_ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    	if(preg_match('/(?i)msie [1-6]/',$catchbox_ua)) {
    		wp_enqueue_script( 'catchbox-pngfix', get_template_directory_uri() . '/js/pngfix.min.js' );
    	}
    	//browser specific queuing i.e. for IE 1-8
    	if(preg_match('/(?i)msie [1-8]/',$catchbox_ua)) {
    	 	wp_enqueue_script( 'catchbox-html5', get_template_directory_uri() . '/js/html5.js' );
    	}
    
    } // catchbox_scripts_method
  5. noearthling
    Member
    Posted 1 year ago #

    Hi Sakin,

    that helped!

    I removed the part you marked as "comment" from the file altogether and it doesn't seem to have any negative effects so far. If you do have any concerns about this, please let me know.

    Thanks again for your help.

  6. Catch Themes
    Member
    Theme Author

    Posted 1 year ago #

    @noearthling: just remember this setting if you have done edits in you core theme file. So, whenever there is update. You can just do it..

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic