Skip to content

Instantly share code, notes, and snippets.

Working from home

Femi YB femiyb

Working from home
View GitHub Profile
View hide_username_field.php
* Hide Username Field.
* Unset required account fields,
femiyb / remove_confirm_email_password.php
Last active Dec 2, 2021
Remove Confirm Email and Password
View remove_confirm_email_password.php
* This recipe will Remove Confirm Email and Confirm Password
* 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.
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;
femiyb / pmpro-prorate-initial-payment.php
Created Sep 11, 2020 — forked from greathmaster/pmpro-prorate-initial-payment.php
Prorate the initial payment. Useful for subscriptions that occur on the first of every month.
View pmpro-prorate-initial-payment.php
function my_pmpro_checkout_level($level)
$current_day = date('j');
$days_in_month = date('t');
$level->initial_payment = $level->initial_payment*(($days_in_month - $current_day)/$days_in_month);
return $level;
femiyb / pmpro-after-expiration-change-membership-levels-adjusted.php Change PMPro membership level upon expiration or cancellation to different respective levels based on member's previous level.
View pmpro-after-expiration-change-membership-levels-adjusted.php
<?php // do not copy to Customizations plugin
* After expiration, assign them a specific "cancelled" level.
* Can be used to downgrade someone to a free level when they cancel.
* Will allow members to the "cancel level" to cancel from that though.
function pmpro_upon_expiration_change_membership_levels( $level_id, $user_id ) {
// set this to the id of the original level
$last_level_2 = 2;
View App.css
* {
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 / pmpro_move_email_fields.php
Created Sep 8, 2020
Move Email And Confirm Email fields
View pmpro_move_email_fields.php
* Add the following code to your PMPro Customizations Plugin -
* Move Email And Confirm Email fields before password
function pmpro_move_email_fields() {
global $pmpro_pages;
if(is_page($pmpro_pages['checkout'])) {
View disable_email_template_memberlevel.php
function my_pmpro_disable_member_emails($recipient, $email)
$user = get_user_by('login', $email->data['user_login']);
$level = pmpro_getMembershipLevelForUser($user->ID);
$disabled_levels = array(1,2,3); //update this to include ids of all levels you want to disable emails for
if(!empty($level) && !empty($level->id) && in_array( intval( $level->id ), $disabled_levels) && $email->template == "membership_recurring")
$recipient = NULL;
femiyb / my_pmpro_always_show_renew_levels.php
Created Jul 30, 2020 — forked from LMNTL/my_pmpro_always_show_renew_levels.php
Always show renew links for certain PMPro levels if the member already has that level.
View my_pmpro_always_show_renew_levels.php
// always show renew links for certain levels if the member already has that level.
function my_pmpro_always_show_renew_levels( $show, $level ){
/*--- change this line to the levels you want to show a renew link---*/
$show_levels = array( 1, 2 );
if( in_array( $level->id, $show_levels ) ) {
$show = true;
View change_my_text_example.php
// Add this code below to your PMPro Customizations plugin -
add_filter( 'gettext', 'change_my_text_example', 20, 3 );
* @link
function change_my_text_example( $translated_text, $text, $domain ) {