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
<? | |
/** | |
* @snippet Display List of Products With No Gallery Image @ WP Dashboard > Products | |
*/ | |
add_action( 'admin_notices', 'products_no_weight_admin' ); | |
function products_no_weight_admin(){ | |
global $pagenow, $typenow; | |
if ( 'edit.php' === $pagenow && 'product' === $typenow ) { | |
echo '<div class="notice notice-warning is-dismissible"><h3 class="dashicons-before dashicons-warning">PRODOTTI SENZA GALLERIA DI IMMAGINI</h3><ul>'; |
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
<?php | |
$livello1 = array("100"); | |
$descrizione1 = array("In ottone"); | |
foreach(array_combine($livello1, $descrizione1) as $livello => $descrizione) | |
{ | |
echo '"/\\\b'.$livello.'\\\b/",'; # "\\b" serve per comprendere l'intera singola stringa e metcharla |
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
<?php | |
function livello1($replace){ | |
/* | |
* Uso " \\b " per prendere esattamente la stringa interessata | |
*/ | |
$livello1 = array("/\\b0100\\b/","/\\b0120\\b/","/\\b0200\\b/","/\\b0220\\b/","/\\b0240\\b/","/\\b0260\\b/","/\\b0265\\b/","/\\b0270\\b/","/\\b0280\\b/","/\\b0290\\b/","/\\b0300\\b/","/\\b0400\\b/","/\\b0410\\b/","/\\b0600\\b/","/\\b0620\\b/","/\\b0640\\b/","/\\b0660\\b/","/\\b0680\\b/","/\\b0700\\b/","/\\b0720\\b/","/\\b0900\\b/","/\\b0920\\b/","/\\b0950\\b/","/\\b3500\\b/"); |
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
<? | |
/* | |
* Insert content with shortcode if product is bought by customer into product | |
*/ | |
add_action('after_setup_theme', 'remove_admin_bar'); | |
function remove_admin_bar() { | |
if (!current_user_can('administrator') && !is_admin()) { |
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_filter ( 'woocommerce_account_menu_items', 'misha_purchased_products_link', 40 ); | |
add_action( 'init', 'misha_add_products_endpoint' ); | |
add_action( 'woocommerce_account_purchased-products_endpoint', 'misha_populate_products_page' ); | |
// here we hook the My Account menu links and add our custom one | |
function misha_purchased_products_link( $menu_links ){ | |
// we use array_slice() because we want our link to be on the 3rd position |
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
<?php | |
// WooCommerce Product Reviews Shortcode | |
add_shortcode( 'product_reviews', 'bbloomer_product_reviews_shortcode' ); | |
function bbloomer_product_reviews_shortcode() { | |
$args = array( | |
'status' => 'approve', |
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
<? | |
/* | |
* Show Out of stock products at the end in Woocommerce | |
*/ | |
add_filter('posts_clauses', 'order_by_stock_status'); | |
function order_by_stock_status($posts_clauses) { | |
global $wpdb; | |
// only change query on WooCommerce loops |
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
<? | |
/** | |
* @snippet Display Discount Percentage @ Loop Pages - WooCommerce | |
*/ | |
// For simple products | |
add_filter( 'woocommerce_get_price_html', 'simple_product_saving_amount', 11, 2 ); | |
function simple_product_saving_amount($price_html, $product) { |