• Hey fellas, I’m trying to edit this code as so

    If
    Product Attribute Scanned text is ‘Image is a stock photo’
    Then do this code

    @media (min-width: 769px) {
    .woocommerce #content div.product div.images,
    .woocommerce div.product div.images,
    .woocommerce-page #content div.product div.images,
    .woocommerce-page div.product div.images {
    width: 30%;
    }
    .woocommerce #content div.product div.summary,
    .woocommerce div.product div.summary,
    .woocommerce-page #content div.product div.summary,
    .woocommerce-page div.product div.summary {
    float: right;
    width: 65%;
    }
    }

    Any ideas on how I can implement this? It’s a fix I’ve found that works with my website to specific listings.

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Anonymous User 17275278

    (@anonymized-17275278)

    What about something like this?

    function hook_css() {
     <?php
      $product_attribute = //get what you need here;
      if($product_attribute == "Image is a stock photo")
       echo '<link rel="stylesheet" type="text/css" href="yourcss.css">';
     ?>
    }
    add_action('wp_head', 'hook_css');

    You can paste this into your function.php, don’t forget to pass your parameter to the variable.

    Thread Starter kanto19

    (@kanto19)

    Could you give me a hand implementing it? I’m having some issues.

    The fuction.php is not allowing me to save the code into it

    Your PHP code changes were rolled back due to an error on line 27 of file wp-content/themes/themify-shoppe/functions.php. Please fix and try saving again.

    syntax error, unexpected ‘<

    Sorry, I have very limited knowledge on advanced coding.

    Thank you for your time!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding a ‘If Product Attribute is’ CSS Code’ is closed to new replies.