Archives: Snippets
Custom Availability Date for Products
/** * Availability Date Functionality * * Adds a custom availability date field to WooCommerce products and variations, * and includes it in product feeds with proper formatting. */ if (!defined(‘ABSPATH’)) { exit; } /** * Format availability date to…Continue reading
Change site url
Enqueue Child Theme’s CSS & Additional CSS in WordPress Editor
/* Enqueue Child Theme style.css to editor */ add_filter(‘block_editor_settings_all’, function($editor_settings) { // Get the URL of the child theme’s style.css $child_theme_style_url = get_stylesheet_directory_uri() . ‘/style.css’; $editor_settings[‘styles’][] = array(‘css’ => wp_remote_get($child_theme_style_url)[‘body’]); return $editor_settings; }); /* Eunqueue Customizer CSS to editor */…Continue reading
Display Roster Entry
/** Display Roster Entry **/ // FOR DEBUGGING ONLY //$data = serialize(array(“Red”, “Green”, “Blue”)); //echo $data . ““; // //$test = unserialize($data); //var_dump($test); // $profile_id = um_profile_id(); $user = get_user($profile_id); $email = $user->email; //FOR DEBUGGING ONLY: // $email = “[email protected]”;…Continue reading
mainpage
MemberPress: Code Blocks Pro – Load All Currently Enqueued Styles In the Courses ReadyLaunch Template
function my_theme_enqueue_scripts() { wp_enqueue_style( ‘code-block’, ‘https://yourdomain.com/wp-content/plugins/code-block-pro/src/front/style.css’, [], ‘1.0.0’, ‘all’ ); wp_enqueue_style( ‘code-block-font’, ‘https://yourdomain.com/wp-content/plugins/code-block-pro/build/fonts/Code-Pro-JetBrains-Mono-NL.ttf’, [], ‘1.0.0’, ‘all’ ); wp_enqueue_style( ‘code-block-css’, ‘https://yourdomain.com/wp-content/plugins/code-block-pro/build/style-index.css’, [], ‘1.0.0’, ‘all’ ); } add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_scripts’ ); add_filter(‘mpcs_classroom_style_handles’, function($allowed_handles){ $allowed_handles[] = ‘code-block’; $allowed_handles[] = ‘code-block-font’; $allowed_handles[] = ‘code-block-css’;…Continue reading
Create An Admin – SQL Query
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`,`user_status`)VALUES (‘<strong>wpstaging</strong>’, MD5(‘password123’), ‘Rene Hermenau’, ‘[email protected]’, ‘0’); INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)VALUES (NULL, (Select max(id) FROM wp_users),’wp_capabilities’, ‘a:1:{s:13:”administrator”;s:1:”1″;}’);Continue reading
MemebrPress: Send MemberPress Welcome Email Only When Transaction Is Completed
function send_welcome_email_on_transaction_completed($event) { $txn = $event->get_data(); // Get the transaction data MeprUtils::send_notices($txn, ‘MeprUserWelcomeEmail’, null, true); // Send the welcome email } add_action(‘mepr-event-transaction-completed’, ‘send_welcome_email_on_transaction_completed’);Continue reading
MemebrPress: Send Membership-Specific Welcome Email Only When Transaction Is Completed
function send_welcome_email_on_transaction_completed($event) { $txn = $event->get_data(); // Get the transaction data $usr = $txn->user(); // Get the user associated with the transaction MeprUtils::maybe_send_product_welcome_notices($txn, $usr); // Send the membership-specific welcome email } add_action(‘mepr-event-transaction-completed’, ‘send_welcome_email_on_transaction_completed’);Continue reading