• Resolved fatherb

    (@fatherb)


    Hi,

    I would like to tell people that the store is currently in testing. there is the option in settings for a Store Notice Text but it displays on every page in the site. Is it possible to show the Store Notice text only on shop pages? If so, how would you do that?

    Thanks

    http://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • Thread Starter fatherb

    (@fatherb)

    I sorted it myself. This may help others. Add this to your child them, functions.php. It will only show the Store Notice Text on shop pages.

    if ( ! function_exists( 'woocommerce_demo_store' ) ) {
    
    	/**
    	 * Adds a demo store banner to the site if enabled
    	 *
    	 * @access public
    	 * @return void
    	 */
    	function woocommerce_demo_store() {
    		if ( get_option( 'woocommerce_demo_store' ) == 'no' )
    			return;
    
    		$notice = get_option( 'woocommerce_demo_store_notice' );
    		if ( empty( $notice ) )
    			$notice = __( 'This is a demo store for testing purposes — no orders shall be fulfilled.', 'woocommerce' );
                    if (! is_woocommerce () )
                            echo apply_filters( 'woocommerce_demo_store', '<p class="demo_store" style="display:none;">' . $notice . '</p>'  );
    		else echo apply_filters( 'woocommerce_demo_store', '<p class="demo_store">' . $notice . '</p>'  );
    	}
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Store notice text only on shop pages’ is closed to new replies.