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 | |
// Set up task when plugin is activated | |
register_activation_hook(__FILE__, 'dcwd_cron_status_setup_schedule'); | |
// On an early action hook, check if the hook is scheduled - if not, schedule it. | |
function dcwd_cron_status_setup_schedule() { | |
// Add the event only if it is not already scheduled. | |
if ( ! wp_next_scheduled( 'dcwd_cron_status_status_email' ) ) { | |
// Schedule weekly at 2:12am. | |
wp_schedule_event( mktime(2,12,0), 'weekly', 'dcwd_cron_status_status_email'); |
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 | |
/* | |
Plugin Name: WooCommerce Stock Info | |
Plugin URI: https://www.damiencarbery.com/2019/10/list-stock-levels-in-woocommerce/ | |
Description: List the stock level for each product and variation. | |
Author: Damien Carbery | |
Author URI: https://www.damiencarbery.com | |
Version: 0.1 | |
*/ |
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 Custom field to WooCommerce product */ | |
add_action( 'woocommerce_product_options_general_product_data', 'wc_custom_add_custom_fields' ); | |
function wc_custom_add_custom_fields() { | |
woocommerce_wp_text_input( array( | |
'id' => '_delivery_field', | |
'label' => __( 'Delivery', 'pvc' ), | |
'description' => __( 'Enter the delivery time in days.', 'pvc' ), | |
'desc_tip' => 'true' | |
) ); | |
} |
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 | |
/** | |
* Custom product field to set low stock threshold | |
* Requires WooCommerce 3.0 | |
*/ | |
function sp_custom_product_stock_threshold_field() { | |
global $post; | |
woocommerce_wp_text_input( array( |
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 | |
//flatsome display text after product detail page image, if product is on sale | |
function display_flatsome_after_product_images() { | |
global $product; | |
if ( $product->is_on_sale() ) | |
{ | |
echo '<div style="color:red; border:1px solid #ccc;">Limited time offer</div>'; | |
} |
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
if ( ! function_exists( 'flatsome_posted_on' ) ) : | |
// Prints HTML with meta information for the current post-date/time and author. | |
function flatsome_posted_on() { | |
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; | |
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { | |
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; | |
} | |
$time_string = sprintf( $time_string, |
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
// Place this in a text widget | |
<p class="mb-0"><i class="icon-checkmark cc-checkmark"></i> Worldwide shipping</p> | |
// Aditional CSS Flatsome > Advanced > Custom CSS | |
.icon-checkmark.cc-checkmark { | |
color: #7a9c59; | |
margin-right: 5px; | |
} |
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 | |
//flatsome product detail page text after excerpt | |
function display_after_short_description($excerpt) { | |
$add_to_excerpt = $excerpt . "<p style='color:green'>Add anything after excerpt</p>"; | |
return $add_to_excerpt; | |
} |
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 | |
/* | |
Flatsome Theme Product On-Sale End Counter | |
*/ | |
function display_onsale_product_counter() { | |
global $product; | |
if ( $product->is_on_sale() ) |