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 | |
// Divi Builder on custom post types by https://wpcolt.com | |
add_filter('et_builder_post_types', 'divicolt_post_types'); | |
add_filter('et_fb_post_types','divicolt_post_types' ); // Enable Divi Visual Builder on the custom post types | |
function divicolt_post_types($post_types) | |
{ | |
foreach (get_post_types() as $post_type) { | |
if (!in_array($post_type, $post_types) and post_type_supports($post_type, 'editor')) { | |
$post_types[] = $post_type; | |
} |
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 | |
/** | |
* Only allow one payment plan purchase (Subscription) at a time | |
*/ | |
add_filter( 'woocommerce_add_to_cart_validation', 'woo_block_sub', 10, 2 ); | |
function woo_block_sub( $valid, $product_id ) { | |
// Get the current product | |
$current_product = wc_get_product( $product_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
// Add Google Tag Manager code in <head> | |
add_action( 'wp_head', 'sk_google_tag_manager1' ); | |
function sk_google_tag_manager1() { ?> | |
<!-- Google Tag Manager --> | |
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | |
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | |
})(window,document,'script','dataLayer','GTM-XXXXXX');</script> | |
<!-- End Google Tag Manager --> |
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 | |
/** | |
* Disable all sales. | |
* | |
* A simple function to disable all the sales in the shop. | |
* Uncomment the line of code to disable the sale price on products. | |
*/ | |
function custom_wc_get_sale_price( $sale_price, $product ) { |
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
/** | |
* All downloads require visitors to be logged in | |
* | |
* @param $can_download | |
* @param $download | |
* | |
* @return bool | |
*/ | |
function dlm_all_downloads_members_only( $can_download, $download ) { |
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: PMPro Customizations | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/ | |
Description: Custom Prorating Code and Other Code for PMPro | |
Version: .1 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
*/ |
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
/* | |
If checking out for a recurring membership for the level the user already has, | |
set the profile start date to their old end date or the date of their next payment. | |
*/ | |
function my_pmpro_profile_start_date($startdate, $order) { | |
//does the user already have this level? | |
if(is_user_logged_in() && pmpro_hasMembershipLevel($order->membership_id)) { | |
global $current_user; | |
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
/* | |
Discount codes can only be used by the same user once. | |
Add this to your active theme's functions.php or a custom plugin. | |
Update the $one_time_use_codes array on line 10. | |
*/ | |
//check if codes have been used already | |
function my_pmpro_check_discount_code($okay, $dbcode, $level_id, $code) | |
{ | |
//define one time use codes | |
$one_time_use_codes = array('ONCE'); //make them all uppercase |
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 modify_edd_cart_contents( $cart ) { | |
$discounts = edd_get_cart_discounts(); | |
if ( !$discounts ) { | |
return $cart; | |
} | |
$dcodes = array( 'YOUDONTHINKIKNOW', 'WHATYOURETRYINGTODO?', 'NICETRY!!' ); | |
// Filter only the discount code above | |
if ( !array_intersect( $discounts, $dcodes ) ) { |
NewerOlder