- Only for echo
- create new array
- For echo/return
- create new array
- return modified value
/* | |
* Woocommerce shop product per page dropdown | |
*/ | |
add_action( 'woocommerce_before_shop_loop', 'gl_asiq_woo_per_page_dropdown', 31 ); | |
function gl_asiq_woo_per_page_dropdown() { | |
$per_page = filter_input( INPUT_GET, 'per_page', FILTER_SANITIZE_NUMBER_INT ); | |
$orderby = filter_input( INPUT_GET, 'orderby', FILTER_SANITIZE_STRING ); | |
$per_page_options = array( | |
'12' => '12', | |
'24' => '24', |
.quantity { | |
display: flex; | |
border: 1px solid rgba(11, 11, 11, 0.1); | |
width: 90px; | |
.qty { | |
padding: 10px; | |
border: 0; | |
background-color: transparent; | |
-moz-appearance: textfield; |
/* | |
* Product Meta Fields | |
*/ | |
add_action( 'woocommerce_product_options_general_product_data', 'woocommerce_product_custom_fields' ); | |
function woocommerce_product_custom_fields() { | |
global $product_object; | |
echo '<div class="product_custom_field">'; | |
// Custom Product Text Field |
Without www, browsers have to store different cookie for every subdomain request. As you can imagine, the process is highly inefficient and slows down loading times on the website as a result.
It is better to use www in URLs
<?php | |
/** | |
* Inspired from: https://gist.github.com/dazecoop/548b2621e86fb030da8e5adb1bfe484f | |
* | |
* How to use: | |
* - add to your function.php or related | |
* | |
* What you can use it for: | |
* Variable products: | |
* - you have variable product with some attributes not used for variations |
let cartBtn = document.querySelector("YOUR CART BUTTON CLASS NAME") | |
const form = document.getElementById("YOUR FORM ID") | |
form.addEventListener("submit", (e) => { | |
e.preventDefault() | |
if (cartBtn.getAttribute("data-variant-id")) { | |
removeItem() | |
} | |
else { | |
addItem() | |
} |
php artisan make:model Todo -mcrf
function wpb_bg() { | |
$rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); | |
$color = '#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)]. $rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)]; | |
echo $color; | |
} | |
// Use | |
<body <?php body_class(); ?> style="background-color:<?php wpb_bg();?>">> |
@media (max-width: 1199px) { | |
.br-fix p br, | |
.br-fix br { | |
content: ""; | |
&:after { | |
content: " "; | |
} | |
} | |
} |