Support » Plugin: NextGEN Gallery Optimizer » Custom css loaded from URL

Viewing 1 replies (of 1 total)
  • Plugin Author Mark Jeldi

    (@mark-jeldi)

    Hi James,

    Thanks for using NextGEN Gallery Optimizer!

    That’s a great question! In fact I might remove the domain prefix in the next version, which would enable loading from a CDN (or even a cloud-based storage solution such as Amazon S3).

    In the meantime, you can make a small modification to Optimizer’s …scripts-and-styles.php to add that capability.

    Simply replace the “load nextgen gallery’s styles (as selected on optimizer’s settings page)” section with the following…

    For the Basic version:

    /**********************************************************************
    * load nextgen gallery's styles (as selected on optimizer's settings page)
    **********************************************************************/
    
    function nggo_load_nextgen_styles() {
    
    	global $nggo_options;
    	$nggo_theme = $nggo_options['theme'];
    	$nggo_nextgen_options = get_option('ngg_options');
    
    	if($nggo_theme == "") { }
    	if($nggo_theme == "Black Minimalism Theme") { define( 'NGGO_NEXTGEN_CSS', 'Black_Minimalism.css' ); }
    	if($nggo_theme == "Default Styles") { define( 'NGGO_NEXTGEN_CSS', 'nggallery.css' ); }
    	if($nggo_theme == "Dkret3 Theme") { define( 'NGGO_NEXTGEN_CSS', 'ngg_dkret3.css' ); }
    	if($nggo_theme == "Hovereffect Styles") { define( 'NGGO_NEXTGEN_CSS', 'hovereffect.css' ); }
    	if($nggo_theme == "K2 Theme") { define( 'NGGO_NEXTGEN_CSS', 'ngg_k2.css' ); }
    	if($nggo_theme == "Shadow Effect") { define( 'NGGO_NEXTGEN_CSS', 'ngg_shadow.css' ); }
    	if($nggo_theme == "Shadow Effect with Description Text") { define( 'NGGO_NEXTGEN_CSS', 'ngg_shadow2.css' ); }
    
    	if($nggo_options['css'] != "") {
    		wp_register_style('custom.css', $nggo_options['css'], false, null, 'screen');
    		wp_enqueue_style('custom.css');
    
    	} else {
    
    		if ($nggo_options['theme'] != "") {
    			wp_register_style('nextgen.css', plugins_url( 'nextgen-gallery/css/'.NGGO_NEXTGEN_CSS.'' , dirname(__FILE__)), false, null, 'screen');
    			wp_enqueue_style('nextgen.css');
    		}
    
    	}
    
    }

    For the Premium version:

    /**********************************************************************
    * load nextgen gallery's styles (as selected on optimizer's settings page)
    **********************************************************************/
    
    function nggop_load_nextgen_styles() {
    
    	global $nggop_options;
    	$nggop_theme = $nggop_options['theme'];
    	$nggop_nextgen_options = get_option('ngg_options');
    
    	if($nggop_theme == "") { }
    	if($nggop_theme == "Black Minimalism Theme") { define( 'NGGOP_NEXTGEN_CSS', 'Black_Minimalism.css' ); }
    	if($nggop_theme == "Default Styles") { define( 'NGGOP_NEXTGEN_CSS', 'nggallery.css' ); }
    	if($nggop_theme == "Dkret3 Theme") { define( 'NGGOP_NEXTGEN_CSS', 'ngg_dkret3.css' ); }
    	if($nggop_theme == "Hovereffect Styles") { define( 'NGGOP_NEXTGEN_CSS', 'hovereffect.css' ); }
    	if($nggop_theme == "K2 Theme") { define( 'NGGOP_NEXTGEN_CSS', 'ngg_k2.css' ); }
    	if($nggop_theme == "Shadow Effect") { define( 'NGGOP_NEXTGEN_CSS', 'ngg_shadow.css' ); }
    	if($nggop_theme == "Shadow Effect with Description Text") { define( 'NGGOP_NEXTGEN_CSS', 'ngg_shadow2.css' ); }
    
    	if($nggop_options['css'] != "") {
    		wp_register_style('custom.css', $nggop_options['css'], false, null, 'screen');
    		wp_enqueue_style('custom.css');
    
    	} else {
    
    		if ($nggop_options['theme'] != "") {
    			wp_register_style('nextgen.css', plugins_url( 'nextgen-gallery/css/'.NGGOP_NEXTGEN_CSS.'' , dirname(__FILE__)), false, null, 'screen');
    			wp_enqueue_style('nextgen.css');
    		}
    
    	}
    
    }

    After this change, you’ll be able to enter the FULL path to your CDN-based stylesheet on Optimizer’s options page.

    Hope this helps!

    Cheers,
    Mark.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom css loaded from URL’ is closed to new replies.