Social Share Buttons (copy)

$post_url = urlencode( get_permalink() ); $post_title = urlencode( get_the_title() ); $facebook_url = “https://www.facebook.com/sharer/sharer.php?u=$post_url”; $x_url = “https://twitter.com/intent/tweet?url=$post_url&text=$post_title”; $linkedin_url = “https://www.linkedin.com/shareArticle?mini=true&url=$post_url&title=$post_title”; $social_buttons = ‘ ‘; echo $social_buttons; // Styles for the social sharing buttons. echo ‘ ‘;Continue reading

WWPP – Restrict add-to-cart on specific products to a specific wholesale role only

// 1. Make the product unpurchasable for non-doctors add_filter( ‘woocommerce_is_purchasable’, ‘wws_restrict_purchase_for_doctors’, 10, 2 ); function wws_restrict_purchase_for_doctors( $is_purchasable, $product ) { $allowed_role = ‘doctors’; $restricted_category = ‘doctors-only’; $product_id = $product->is_type( ‘variation’ ) ? $product->get_parent_id() : $product->get_id(); if ( has_term( $restricted_category, ‘product_cat’,…Continue reading

Removal Redirect

add_action(‘template_redirect’, function () { if (is_admin()) { return; } $request_path = trim(parse_url($_SERVER[‘REQUEST_URI’], PHP_URL_PATH), ‘/’); // Match /removal-request/ on any mapped subsite domain if ($request_path === ‘removal-request’) { wp_safe_redirect(home_url(‘/privacy-policy-2/’), 301); exit; } });Continue reading