• Resolved mellow1

    (@cdsigns)


    When the store is closed we get a “banner” to display: “store is closed”, this html-code if I’m correct

    <div class="wfs-store-close-msg">
    <span>
            We zijn nu gesloten.      
    </span>
    </div>

    We would like to change some of the css to the rest of the page. to .entry-title for example, when the store is closed.

    We think it should be possible to do with some javascript / jquery-code to detect if the banner is present and add css when it is. But we can’t manage to get it working.

    Can you be of any assistance? Is there some way to detect if the banner is present or can we add a class to the <body> when the store is closed?

    Thank you so much

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter mellow1

    (@cdsigns)

    if(jQuery('#wfs-food-items .wfs-store-close-msg').length) { jQuery('.entry-title').css('background', 'red'); }

    When we run this code in console it works, but through enqueued .js file it doesn’t work.

    Plugin Author WP Scripts

    (@wpscripts)

    Hello @cdsigns

    This code will help you. Make sure to put it in functions.php of your activated theme.

    function my_body_classes( $classes ) {
    
    	if( wfs_check_store_closed() ) {
    		$classes[] = 'class-name';
    	}
    	return $classes;
    }
    add_filter( 'body_class','my_body_classes' );

    Regards,
    Team WP Scripts

    Thread Starter mellow1

    (@cdsigns)

    Thank you very much, works like a charm!

    Plugin Author WP Scripts

    (@wpscripts)

    Hello

    Thank you for the update. Please do review the plugin if you like the plugin and our support.

    Thanks & Regards,
    Team WP Scripts

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change css when store is closed’ is closed to new replies.