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 | |
/** Flush all caches of W3TC | |
* Weekly basis | |
*/ | |
//add weekly shcedule to wp cron | |
function dctit_cron_add_weekly( $schedules ) { | |
//adds once weekly to the existing schedules. | |
$schedules['weekly'] = array( | |
'interval' => 604800, |
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 | |
/** | |
* Auto Complete all WooCommerce orders. | |
*/ | |
function dctit_custom_woocommerce_auto_complete_order( $order_id ) { | |
if ( ! $order_id ) { | |
return; | |
} | |
$order = wc_get_order( $order_id ); |
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 | |
function dctit_add_coupon_to_email( $order ) { | |
$coupons = $order->get_items('coupon'); | |
foreach ($coupons as $item_id => $item) { | |
$coupon = new WC_Coupon( $item['name'] ); | |
$post = get_post($coupon->id); | |
echo "<p class='coupon-used'><span class='coupon-name'><b>Coupon: " . $item['name'] . "</b></span></p>"; | |
echo "<p><span class='coupon-description'>" . $post->post_excerpt . "</span></p>"; | |
} |
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 | |
/* | |
* Modify Default Search URL | |
* old url: domain.com?s=[search_term] | |
* new url: domain.com/search/[search_term] | |
*/ | |
function dctit_change_search_url() { | |
if ( is_search() && ! empty( $_GET['s'] ) ) { | |
wp_redirect( home_url( "/search/" ) . urlencode( get_query_var( 's' ) ) ); | |
exit(); |
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 | |
/** | |
* code goes inside "includes/hooks" directory | |
*/ | |
/** | |
* Client Area Ticket View - Show Oldest Reply First | |
* @param $vars | |
* @return array | |
*/ |
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 | |
/** | |
* code goes inside "includes/hooks" directory | |
*/ | |
/** | |
* Remove Announcements from homepage | |
*/ | |
function dctit_remove_announcements_from_homepage( $home_page_panels) { | |
$home_page_panels->removeChild('Recent News'); |
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 | |
/** | |
* code goes inside "includes/hooks" directory | |
*/ | |
//for customizing nav menu items | |
use WHMCS\View\Menu\Item as MenuItem; | |
//for interacting with DB | |
use Illuminate\Database\Capsule\Manager as Capsule; |
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 | |
/** | |
* ACF fields don't show up when previewing draft posts. This is an ugly hack to try and overcome that situation. | |
*/ | |
function dctit_hack_preview() { | |
$post_types = array ( 'post', 'page' );//add/edit/delete post types as needed | |
global $post; | |
if ( !in_array( $post->post_type, $post_types ) ) { | |
return; |
OlderNewer