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 | |
/* | |
* Create order dynamically | |
*/ | |
add_action( 'woocommerce_before_checkout_form', 'create_order' ); | |
function create_order() { | |
global $woocommerce; | |
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
sites | |
|__ ms.dev | |
| |__ content | |
| |__ index.php | |
| |__ wp => ../../wordpress/stable | |
| |__ wp-config.php | |
|__ one.dev | |
| |__ content | |
| |__ index.php | |
| |__ wp => ../../wordpress/stable |
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
/** | |
* Redirect to checkout at add-to-cart action. | |
*/ | |
function redirect_to_checkout() { | |
return WC()->cart->get_checkout_url(); | |
} | |
add_filter( 'woocommerce_add_to_cart_redirect', 'redirect_to_checkout' ); | |
------------------------------------ |
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 | |
/** | |
* Process Order Refund through Code | |
* @return WC_Order_Refund|WP_Error | |
*/ | |
function ibenic_wc_refund_order( $order_id, $refund_reason = '' ) { | |
$order = wc_get_order( $order_id ); | |
// IF it's something else such as a WC_Order_Refund, we don't want that. |
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
/** | |
* Exclude Subscribers | |
* @mycred | |
* @version 1.0 | |
*/ | |
add_filter( 'mycred_exclude_user', 'mycredpro_exclude_wp_subscribers', 10, 2 ); | |
function mycredpro_exclude_wp_subscribers( $exclude, $user_id ) { | |
// Exclude subscribers | |
if ( ! user_can( $user_id, 'edit_posts' ) ) return true; |
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 | |
$url = isset($_GET['url']) ? $_GET['url'] : null; | |
if (!$url) { | |
die('Please, inform URL'); | |
} | |
$imgInfo = getimagesize( $url ); |
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
Download Google Drive files with WGET | |
Example Google Drive download link: | |
https://docs.google.com/open?id=[ID] | |
To download the file with WGET you need to use this link: | |
https://googledrive.com/host/[ID] | |
Example WGET command: |
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
/** | |
* Get the applicable limit for the given role. | |
* | |
* @param string $role role name. | |
* | |
* @return array | |
*/ | |
function buddydev_custom_get_role_based_message_limit( $role ) { |
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 | |
/** | |
* Plugin Name: Photon CDN | |
* Version: 1.3 | |
* Description: Use the WP.com Photon image CDN without installing JetPack | |
* Author: Scott Hartley | |
* Credit: Original by Zachary Scott | |
*/ | |
namespace zacscott; |