Last active
September 13, 2025 16:07
-
-
Save paaljoachim/2eb9587902ed05f84f69b2535af5ff21 to your computer and use it in GitHub Desktop.
Gullhuset - working on product cards with Lovable and Claude and ChatGPT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action('wp_enqueue_scripts', function() { | |
| wp_register_style('lovable-product-cards', false); | |
| wp_enqueue_style('lovable-product-cards'); | |
| $css = <<<CSS | |
| /* Product Grid */ | |
| ul.products, | |
| ul.wp-block-products, | |
| div.wp-block-columns { | |
| display: flex !important; | |
| flex-wrap: wrap !important; | |
| justify-content: center !important; | |
| gap: 0.4rem !important; | |
| padding: 2rem !important; | |
| margin: 0 auto !important; | |
| } | |
| /* Product Card */ | |
| li.product { | |
| flex: 0 0 300px !important; | |
| max-width: 300px !important; | |
| min-height: 380px !important; | |
| background: #fff !important; | |
| border-radius: 12px !important; | |
| border: 1px solid #f3f4f6 !important; | |
| box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1) !important; | |
| display: flex !important; | |
| flex-direction: column !important; | |
| align-items: center !important; | |
| text-align: center !important; | |
| padding-bottom: 1rem !important; | |
| box-sizing: border-box !important; | |
| margin: 0.2rem !important; | |
| } | |
| /* Product Title */ | |
| li.product .woocommerce-loop-product__title { | |
| font-size: 1rem !important; | |
| font-weight: 600 !important; | |
| color: #1f2937 !important; | |
| margin: 1rem 1.25rem 0.5rem !important; | |
| line-height: 1.4 !important; | |
| display: -webkit-box !important; | |
| -webkit-line-clamp: 2 !important; | |
| -webkit-box-orient: vertical !important; | |
| overflow: hidden !important; | |
| min-height: 2.8rem !important; | |
| } | |
| /* Price */ | |
| li.product .price { | |
| font-size: 1.25rem !important; | |
| font-weight: 700 !important; | |
| color: #d4af37 !important; | |
| margin: 0 1rem 0.5rem !important; | |
| } | |
| /* Add to Cart Button */ | |
| li.product .add_to_cart_button, | |
| li.product .product_type_simple, | |
| li.product .product_type_variable { | |
| background: linear-gradient(135deg, #d4af37, #f0c674) !important; | |
| color: #fff !important; | |
| border: none !important; | |
| border-radius: 8px !important; | |
| padding: 10px 20px !important; | |
| font-weight: 600 !important; | |
| font-size: 13px !important; | |
| text-transform: uppercase !important; | |
| letter-spacing: 0.5px !important; | |
| margin-bottom: 1.25rem !important; | |
| text-align: center !important; | |
| box-shadow: 0 8px 15px rgba(212,175,55,0.3) !important; | |
| opacity: 0 !important; | |
| transform: translateY(10px) !important; | |
| transition: all 0.4s cubic-bezier(.4,0,.2,1) !important; | |
| } | |
| /* Hover effects: show button, glow, scale */ | |
| li.product:hover .add_to_cart_button, | |
| li.product:hover .product_type_simple, | |
| li.product:hover .product_type_variable { | |
| opacity: 1 !important; | |
| transform: translateY(0) scale(1.05) !important; | |
| box-shadow: 0 10px 25px rgba(212, 175, 55, 0.5) !important; | |
| } | |
| /* Product Description Hover Color */ | |
| li.product:hover .woocommerce-loop-product__excerpt { | |
| color: #d4af37 !important; | |
| } | |
| /* Sticky header */ | |
| header:has(>.is-position-sticky) { | |
| position: sticky; | |
| top: calc( 0px + var( --wp-admin--admin-bar--height, 0px ) ); | |
| z-index: 100; | |
| } | |
| @media (max-width: 600px) { | |
| header:has(>.is-position-sticky) { | |
| top: 0; | |
| } | |
| } | |
| /* Responsive Layout */ | |
| @media (max-width: 1024px) { | |
| li.product { | |
| flex: 0 0 calc(50% - 0.4rem) !important; | |
| max-width: calc(50% - 0.4rem) !important; | |
| } | |
| } | |
| @media (max-width: 768px) { | |
| li.product { | |
| flex: 0 0 100% !important; | |
| max-width: 100% !important; | |
| } | |
| } | |
| CSS; | |
| wp_add_inline_style('lovable-product-cards', $css); | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Original version
/**
*/
function gullhuset_wc_products_shortcode($atts) {
// Shortcode attributes
$atts = shortcode_atts(array(
'limit' => 6,
'columns' => 3,
'orderby' => 'menu_order',
'order' => 'ASC',
'ids' => '',
'skus' => '',
'category' => '',
'tag' => '',
'class' => '',
'on_sale' => false,
'best_selling' => false,
'top_rated' => false
), $atts, 'gullhuset_products');
}
// Register shortcode
add_shortcode('gullhuset_products', 'gullhuset_wc_products_shortcode');
// Add custom body class when our shortcode is used OR on WooCommerce pages
function gullhuset_add_body_class($classes) {
global $post;
}
add_filter('body_class', 'gullhuset_add_body_class');
// Note: CSS styling should be added separately via woocommerce-gullhuset-styles.css
// This version removes inline CSS to prevent conflicts with external stylesheets