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: AffiliateWP - Store Credit - Disable Store Credit Per Affiliate | |
| * Plugin URI: https://affiliatewp.com | |
| * Description: Disable store credit per affiliate if store credit is globally enabled for all affiliates | |
| * Author: Tunbosun Ayinla | |
| * Author URI: https://affiliatewp.com | |
| * Version: 1.0 | |
| */ |
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
| /*-- Disable Recurring Refferals On New Affiliate --*/ | |
| function set_recurring_disabled_on_new_affiliate( $affiliate_id ) { | |
| affwp_update_affiliate_meta( $affiliate_id, 'recurring_disabled', 1 ); | |
| } | |
| add_action( 'affwp_insert_affiliate', 'set_recurring_disabled_on_new_affiliate' ); | |
| /*-- Bulk Disable Recurring Refferal on Affiliate List --*/ | |
| add_filter( 'affwp_affiliates_bulk_actions', 'bulk_disable_recurring_refferrals_name' ); | |
| function bulk_disable_recurring_refferrals_name($actions){ | |
| $actions['disablerecurring'] = 'Disable Recurring Refferals'; |
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 Bulk Enroll / Remove options for each LearnDash Course in User List | |
| ---*/ | |
| function add_course_bulk_actions( $actions ) { | |
| $courses = get_posts( array( | |
| 'post_type' => 'sfwd-courses', | |
| 'posts_per_page' => -1, | |
| 'post_status' => 'publish', | |
| ) ); |
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_filter('woocommerce_checkout_show_terms', 'remove_terms_and_conditions_checkbox_for_specific_category'); | |
| function remove_terms_and_conditions_checkbox_for_specific_category($show_terms) { | |
| // Check if WooCommerce is active and the cart object is available | |
| if (in_array('woocommerce/woocommerce.php', get_option('active_plugins')) && WC()->cart) { | |
| // Define the product category slug to check for | |
| $targeted_category_slug = 'your-product-cat-slug-here'; | |
| // Get the cart contents | |
| $cart_items = WC()->cart->get_cart(); |
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
| // Recurring Total line items | |
| add_filter( 'woocommerce_subscription_price_string', 'wc_subscription_recurring_price_string', 10, 2 ); | |
| function wc_subscription_recurring_price_string( $subscription_string, $subscription_details ) { | |
| if ( ( is_checkout() && ! is_wc_endpoint_url() ) ) { | |
| $recurring_amount = $subscription_details['recurring_amount']; | |
| //If this is a switch order with a Specific Coupon applied | |
| if( WC()->cart->get_total( 'edit' ) == 0.00 && WC()->cart->has_discount( 'COUPON-NAME-HERE' ) && strpos($recurring_amount, '149.00') !== false){ | |
| return $recurring_amount . ' / 1st year<br>then $199.00 / year'; | |
| } else { |
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
| //For Use with Elementor Lesson List & topic List Grid widgets | |
| add_filter( 'learndash_course_grid_html_output', 'learndash_course_grid_add_avilable_date', 10, 4 ); | |
| function learndash_course_grid_add_avilable_date( $data, $post, $shortcode_atts, $user_id ) { | |
| if ( 'sfwd-topic' == $post->post_type || 'sfwd-lessons' == $post->post_type ) { | |
| $course_id = $shortcode_atts['course_id']; | |
| if( $course_id ){ | |
| $attributes = learndash_get_course_step_attributes( $post->ID, $course_id, $user_id ); | |
| $is_sample = ( isset( $lesson->sample ) ? $post->sample : false ); | |
| $ld_lesson_has_access = sfwd_lms_has_access( $post->ID, $user_id ); | |
| $ld_available_date = learndash_course_step_available_date( $post->ID, $course_id, $user_id, 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
| add_filter( 'affwp_leaderboard_defaults', 'group_affwp_leaderboard_defaults', 10 ); | |
| function group_affwp_leaderboard_defaults( $defaults ) { | |
| $defaults['connected_to'] = array( | |
| 'get_connectable' => 'affiliate', | |
| 'where_connectable' => 'group', | |
| 'where_id' => 2, // ID of the affiliate group | |
| 'where_group_type' => 'affiliate-group', | |
| ); | |
| return $defaults; |
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
| /** | |
| * Output an ACF post relationship field type using a shortcode: | |
| * [acf_relationship_field field="field_name" show="all"] | |
| * You can also pass `post_id` as an attribute | |
| * | |
| * Show parameter accepts any comma seperated combination of: all, title, title_linked, date, author, post_excerpt, post_content | |
| * | |
| * Works with Post Object and Relationship fields, when the return | |
| * format is both post object and post ID | |
| * |
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
| // Initialize the global flag on the wp action hook | |
| add_action('wp', 'initialize_force_public_page_flag'); | |
| function initialize_force_public_page_flag() { | |
| global $is_force_public_page, $wp_query; | |
| $is_force_public_page = false; | |
| if (!empty($wp_query->queried_object_id)) { | |
| $is_force_public_page = get_post_meta($wp_query->queried_object_id, '_wc_memberships_force_public', true) === 'yes'; | |
| } | |
| } |
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
| // Register custom sidebar | |
| function custom_register_sidebars() { | |
| register_sidebar( array( | |
| 'name' => 'Header', | |
| 'id' => 'header_sidebar', | |
| 'description' => 'Widgets in this area will be shown in the header.', | |
| 'before_widget' => '<div id="%1$s" class="widget %2$s">', | |
| 'after_widget' => '</div>', | |
| 'before_title' => '<h2 class="widgettitle">', | |
| 'after_title' => '</h2>', |