Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Femi YB femiyb

🏠
Working from home
View GitHub Profile
@femiyb
femiyb / minimum_cart_cat.php
Created Nov 19, 2021
WooCommerce Minimum Cart Total per category
View minimum_cart_cat.php
function cat_cart_count( $cat_name ) {
$cat_count = 0;
// Iterating through each cart item
foreach(WC()->cart->get_cart() as $cart_item)
if( has_term( $cat_name, 'product_cat', $cart_item['product_id']))
$cat_count += $cart_item['quantity'];
return $cat_count;
}
View App.css
/* CHAT STYLES */
* {
font-family: Avenir, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji,
Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
letter-spacing: 0.5px;
}
.ce-chat-list {
background-color: rgb(240, 240, 240) !important;
@femiyb
femiyb / custom_pmproeewe_email_frequency.php
Last active Aug 19, 2021 — forked from kimcoleman/custom_pmproeewe_email_frequency.php
Filter the settings of email frequency when using the Extra Expiration Warning Emails Add On
View custom_pmproeewe_email_frequency.php
<?php
/**
* Filter the settings of email frequency sent when using the Extra Expiration Warning Emails Add On
* https://www.paidmembershipspro.com/add-ons/extra-expiration-warning-emails-add-on/
*
* Update the $settings array to your list of number of days => ''.
* Read the Add On documentation for additional customization using this filter.
*/
function custom_pmproeewe_email_frequency( $settings = array() ) {
@femiyb
femiyb / pmpro-customizations.php
Created Aug 19, 2021 — forked from travislima/pmpro-customizations.php
PMPro-extra-expiration-warning-emails (Change day email is sent out)
View pmpro-customizations.php
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for Paid Memberships Pro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
View pmpro-membership-profile-display.php
<?php
/*
* Display Member Number on Edit Profile Page for Admin
*
*/
// We have to put everything in a function called on init, so we are sure Register Helper is loaded.
function my_pmprorh_init_member_number() {
// Don't break if Register Helper is not loaded.
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
@femiyb
femiyb / assign_pmpro_level_to_role.php
Last active Aug 3, 2021
Assign a LEVEL to a unique role with Expiration Date
View assign_pmpro_level_to_role.php
<?php
/**
* Assign a LEVEL to a unique role with Expiration Date
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@femiyb
femiyb / shop_manager_show_admin_bar.php
Created Aug 2, 2021
Give Shop Managers access to dashboard
View shop_manager_show_admin_bar.php
<?php
/**
* This will Give WooCommerce Sho[p Managers access to the dashboad of you are removing access for other users
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function shop_manager_show_admin_bar() {
if(current_user_can('shop_manager')) {
add_filter( 'show_admin_bar', '__return_true' );
}
}
@femiyb
femiyb / redirect_users_after_login.php
Last active Jul 20, 2021 — forked from andrewlimaza/redirect_users_after_login.php
Redirect Users After Login For WordPress
View redirect_users_after_login.php
<?php
/**
* Redirect all non-admin user's after they login to your website's home page.
* Documentation for login_redirect filter - https://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect
* Visit https://yoohooplugins.com for more tutorials.
*/
function yh_redirect_after_login( $redirect_to, $request, $user ) {
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
@femiyb
femiyb / custom-level-text-per-level-id.php
Created Jul 12, 2021 — forked from ipokkel/custom-level-text-per-level-id.php
Change level name and page title for a specific level checkout
View custom-level-text-per-level-id.php
<?php
function my_custom_level_cost_text( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Membership Level':
$translated_text = __( 'My Membership Level Name', 'paid-memberships-pro' );
break;
}
@femiyb
femiyb / my-pmpro-change-seat-to-student.php
Last active Jul 9, 2021 — forked from andrewlimaza/my-pmpro-change-seat-to-member.php
Change the word "Seat(s)" to "student(s)" for Paid Memberships Pro Sponsored Members Add On.
View my-pmpro-change-seat-to-student.php
<?php
/**
* This will change all instances of seat(s) to student(s) for the Sponsored Members Add On - https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/
* Add the code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_change_seat_to_student( $output_text, $input_text, $domain ) {
if ( 'pmpro-sponsored-members' === $domain ) {
$output_text = str_replace( 'seats', 'students', $output_text );
$output_text = str_replace( 'Seats', 'Students', $output_text );