On Browsing EDD Products

add_action( ‘edd_after_download_content’, ‘pe_edd_browse_script’ ); function pe_edd_browse_script( $download_id ) { $browse_campaign_name = ‘Enter browse abandonment campaign name’; do_action(‘pe_wpcode_edd_browse_script’, $download_id, $browse_campaign_name); }Continue reading

Show Products Count on WooCommerce Archive Pages

add_shortcode( ‘product_count’, ‘product_count_shortcode’ ); function product_count_shortcode() { global $wp_query; $total_product_count = $wp_query->found_posts; $current_page = max( 1, get_query_var( ‘paged’ ) ); $products_per_page = get_option( ‘posts_per_page’ ); $start_product = ( ( $current_page – 1 ) * $products_per_page ) + 1; $end_product =…Continue reading

WooCommerce Checkout Fields Auto-Populate

/** * Unhook Checkout Autocomplete */ add_filter( ‘woocommerce_checkout_get_value’, ‘bks_remove_values’, 10, 2 ); function bks_remove_values( $value, $input ) { $item_to_set_null = array( ‘billing_first_name’, ‘billing_last_name’, ‘billing_company’, ‘billing_address_1’, ‘billing_address_2’, ‘billing_city’, ‘billing_postcode’, ‘billing_country’, ‘billing_state’, ‘billing_email’, ‘billing_phone’, ‘shipping_first_name’, ‘shipping_last_name’, ‘shipping_company’, ‘shipping_address_1’, ‘shipping_address_2’, ‘shipping_city’, ‘shipping_postcode’, ‘shipping_country’,…Continue reading

Forms ACF Add-On

add_filter( ‘forminator_render_fields_markup’, function( $html, $wrappers ){ $replacements = array( ‘%my_value_1%’ => ”, ‘%my_value_2%’ => ”, ‘%my_value_3%’ => ”, ‘%my_value_4%’ => ”, ); if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); $replacements = array( ‘%my_value_1%’ => get_user_meta( $current_user->ID, ‘field_1’, true ),…Continue reading

Email Address Shortcode

// Check if a user is logged in if (is_user_logged_in()) { // Get the current user’s information $current_user = wp_get_current_user(); // Get the user’s email address $user_email = $current_user->user_email; // Check if the email address is not empty if (!empty($user_email))…Continue reading

Full Name Shortcode

// Check if a user is logged in if (is_user_logged_in()) { // Get the current user’s information $current_user = wp_get_current_user(); // Get the first name and last name of the user $first_name = $current_user->first_name; $last_name = $current_user->last_name; // Check if…Continue reading

Last Name Shortcode

// Check if a user is logged in if (is_user_logged_in()) { // Get the current user’s information $current_user = wp_get_current_user(); // Get the last name of the user $last_name = $current_user->last_name; // Check if the last name is not empty…Continue reading

First Name Shortcode

// Check if a user is logged in if (is_user_logged_in()) { // Get the current user’s information $current_user = wp_get_current_user(); // Get the first name of the user $first_name = $current_user->first_name; // Check if the first name is not empty…Continue reading

Log Out

function change_menu($items){ foreach($items as $item){ if( $item->title == “Log Out”){ $item->url = wp_logout_url(‘/’); } } return $items; } add_filter(‘wp_nav_menu_objects’, ‘change_menu’);Continue reading

WooCommerce Quality Selector

add_action( ‘woocommerce_after_add_to_cart_quantity’, ‘ts_quantity_plus_sign’ ); function ts_quantity_plus_sign() { echo ‘+‘; } add_action( ‘woocommerce_before_add_to_cart_quantity’, ‘ts_quantity_minus_sign’ ); function ts_quantity_minus_sign() { echo ‘–‘; } add_action( ‘wp_footer’, ‘ts_quantity_plus_minus’ ); function ts_quantity_plus_minus() { // To run this on the single product page if ( ! is_product()…Continue reading