This file contains 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 | |
/** | |
* Bulk Refund Orders | |
* | |
* This script expects a csv file with following columns: | |
* - Order ID 1002 | |
* - Reason for refund 'Item was oversold.' | |
* - Amount to refund '34.56' | |
* - Refund payment true/false | |
* - Restock item true/false |
This file contains 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 | |
/** | |
* Fetches remote data with dual-layer caching. | |
* | |
* Uses wp_remote_get to fetch remote data. The data is cached twice: it's | |
* stored in a transient and an option. The transient is used as the main cache | |
* but if the transient has expired and the remote site doesn't respond, | |
* backup data from the option is returned. | |
* |
This file contains 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 | |
/** | |
* Attachment processing intermediary to work between Relevanssi and a Tika server. | |
* | |
* Installation instructions: | |
* 1. Save this as index.php. | |
* 2. Change the Tika server URL in the constructor to point to your own Tika server. | |
* 3. Upload this file in a directory on your server. | |
* | |
* @author Mikko Saari ([email protected]) |
This file contains 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
class add_more_to_cart { | |
private $prevent_redirect = false; //used to prevent WC from redirecting if we have more to process | |
function __construct() { | |
if ( ! isset( $_REQUEST[ 'add-more-to-cart' ] ) ) return; //don't load if we don't have to | |
$this->prevent_redirect = 'no'; //prevent WC from redirecting so we can process additional items | |
add_action( 'wp_loaded', [ $this, 'add_more_to_cart' ], 21 ); //fire after WC does, so we just process extra ones | |
add_action( 'pre_option_woocommerce_cart_redirect_after_add', [ $this, 'intercept_option' ], 9000 ); //intercept the WC option to force no redirect | |
} |
This file contains 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 | |
add_action( 'elementor/element/before_section_end', function( $element, $section_id, $args ) { | |
/** @var \Elementor\Element_Base $element */ | |
if ('theme-post-featured-image' === $element->get_name()) { | |
This file contains 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 | |
/** | |
* When performing an admin search for WooCommerce Orders, use the 'Orders' SearchWP engine | |
*/ | |
function my_searchwp_search_args( $args ) { | |
$search_in_admin = apply_filters( 'searchwp_in_admin', false ); | |
if ( wp_doing_ajax() || empty( $_GET['post_type'] ) || ! is_admin() || empty( $search_in_admin ) ) { | |
return $args; |
This file contains 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 | |
// this file is supposed to be in UTF-8 without BOM | |
function isRunningOnWindows() { | |
$os = php_uname('s'); //PHP_OS see https://stackoverflow.com/q/1482260/3995261 | |
return preg_match('#win#i',$os) ? true : false; | |
} | |
function fixFilenameEncoding($name) { | |
// seemingly is needed on Windows only because filename encoding is not utf-8 | |
return isRunningOnWindows() ? mb_convert_encoding($name, "windows-1251", "utf-8") : $name; | |
} |
This file contains 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 | |
/** | |
* Payment subscriptions and updating billing and cancelling subscriptions takes place with these hooks | |
* We need the stripe customer user id for updating billing | |
* we need the entry id of subscription so we can cancel it. | |
*/ | |
/** | |
* @param $entry |
This file contains 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
<div class="comments-block"> | |
<button id="show-comments" onclick="disqus();return false;">Load Comments</button> | |
</div> | |
<div id="disqus_thread"></div> | |
<script> | |
var disqus_loaded = false; | |
var disqus_shortname = 'xxxx'; //Add your shortname here |
This file contains 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 Image Stretch Option Control to the Image Gallery Widget */ | |
add_action( 'elementor/element/before_section_end', function( $element, $section_id, $args ) { | |
/** @var \Elementor\Element_Base $element */ | |
if ( 'image-gallery' === $element->get_name() && 'section_gallery' === $section_id ) { | |
$element->add_control( | |
'image_stretch', | |
[ | |
'label' => __( 'Image Stretch', 'elementor' ), | |
'type' => \Elementor\Controls_Manager::SELECT, |
NewerOlder