• Resolved wwwilson

    (@wwwilson)


    Hello,

    Great plugin! Really enjoying the flexibility of being able to create products on the fly with the shortcode.

    Quick question on changing the form’s CSS. I have tried both CSS and jQuery overrides for changing classes in the payment form popup however neither are being accepted. However, if I save exactly same CSS in the plugin’s wp-admin backend the style overrides successfully.

    I am currently using your plugin across multiple environments so it is much more efficient to update from a single file. Is there a way to programmatically change the CSS from a file within the theme instead of the wp backend and if so how can I do this?

    Cheers,

    Wilson

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Alexander C.

    (@alexanderfoxc)

    Hi.

    You can make your own mini-plugin (or add this code to your child theme, if you prefer) that would do the thing for you. You need to hook to asp_ng_pp_output_add_styles and add your custom CSS file like this:

    function add_custom_css_file( $styles ) {
    	$styles[] = array(
    		'footer' => true,
    		'src'    => 'https://example.com/my_css_file.css',
    	);
    	return $styles;
    }
    
    add_filter( 'asp_ng_pp_output_add_styles', 'add_custom_css_file' );
    

    This way your custom CSS file will be included in the footer, thus overriding any other CSS properties.

    If you don’t want to use CSS file but want to output CSS directly to the HTML code, you can hook to asp_ng_pp_output_before_closing_body action like this:

    function output_custom_css() {
    	// this will change submit button color to green
    	echo '<style>#submit-btn{background-color: green;}</style>';
    }
    
    add_filter( 'asp_ng_pp_output_before_closing_body', 'output_custom_css' );
    
    Thread Starter wwwilson

    (@wwwilson)

    Hey Alexander, Perfect. Just what I was looking for. Thank you for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom CSS’ is closed to new replies.