Snippets

DRDoGE Conditional Custom CSS on WordPress pages

Created by DRDoGE last modified
<?php
    /**
     * Add custom CSS to WooCommerce product or checkout pages
     */
     function enqueue_custom_cryptowoo_styles() {

        // Use is_product() to determine if we are on the product page
        // Use is_checkout() to determine if we are on the checkout page
        if ( is_checkout() ) { // If we are on a WooCommerce checkout page
     ?>
     <style type="text/css">
          .priceinfo { font-weight:bold; }
          .exchangeinfo { font-size: 70%; }
          #price-BTC { background-color: red; }
          #price-LTC { background-color: green; }
          #price-DOGE { background-color: yellow; }
          #price-BLK { background-color: turquoise; }
     </style>
     <?php }
     }
     
     add_action('wp_head', 'enqueue_custom_cryptowoo_styles', 100);

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.