add_action( ‘template_redirect’, ’empty_cart_redirection’ ); function empty_cart_redirection(){ if( is_checkout() ) : // Here set the Url redirection // $url_redirection = get_permalink( wc_get_page_id( ‘shop’ ) ); $url_redirection = get_home_url(); // When trying to access cart page if cart is already empty if(…Continue reading
add_filter( ‘wc_add_to_cart_message’, ‘asa_custom_wc_add_to_cart_message’, 10, 2 ); function asa_custom_wc_add_to_cart_message( $message, $product_id ) { $message = sprintf(esc_html__(‘%s has been added to your cart.’), get_the_title( $product_id ) ); return $message; }Continue reading
/** * Hindra åtkomst till /wp-admin för prenumeranter */ add_action( ‘admin_init’, function() { if ( is_user_logged_in() ) { $user = wp_get_current_user(); if ( in_array( ‘subscriber’, (array) $user->roles, true ) ) { if ( ! ( defined( ‘DOING_AJAX’ ) && DOING_AJAX…Continue reading
/** * 2) Dölj admin-baren för prenumeranter */ add_filter( ‘show_admin_bar’, function( $show ) { if ( is_user_logged_in() ) { $user = wp_get_current_user(); if ( in_array( ‘subscriber’, (array) $user->roles, true ) ) { return false; } } return $show; });Continue reading
/** * 1) Omdirigera prenumeranter till startsidan efter inloggning */ add_filter( ‘login_redirect’, function( $redirect_to, $requested_redirect_to, $user ) { if ( $user instanceof WP_User && in_array( ‘subscriber’, (array) $user->roles, true ) ) { return home_url(‘/’); } return $redirect_to; }, 10, 3…Continue reading
// —- Guards so you can import on any site safely if (!function_exists(‘adv_get_config’)) { function adv_get_config($key, $default = null) { // 1) Filter override $filtered = apply_filters(“advision_config_{$key}”, null); if ($filtered !== null) return $filtered; // 2) Constant override (from wp-config.php)…Continue reading
// —————————————————————————– // Helpers (safe across sites) // —————————————————————————– if (!function_exists(‘adv_collect_sportsbook_fields’)) { /** * Collect ACF fields for the sportsbook CPT. * @param null|string $type_filter e.g., ‘image’, ‘color_picker’; null = all * @param bool $exclude_images set true to exclude images…Continue reading
if ( class_exists( ‘\Elementor\Core\DynamicTags\Tag’ ) && function_exists( ‘get_field’ ) ) { class SC_Get_Tag extends \Elementor\Core\DynamicTags\Tag { public function get_name() { return ‘sc_get_tag’; } public function get_title() { return __( ‘Short Code Field’, ‘textdomain’ ); } public function get_group() { return…Continue reading
/** * Native Innovation — Homepage via shortcode (fixed syntax) * Usage: Add as a WPCode PHP Snippet (Frontend), then place [native_homepage] on your Home page. */ if ( ! function_exists(‘ni_homepage_shortcode’) ) { function ni_homepage_shortcode($atts = []) { $contact_url =…Continue reading
/** * Native Innovation — Homepage via shortcode * Usage: Add as a WPCode PHP Snippet (Frontend), then place [native_homepage] on your Home page. */ if (!function_exists(‘ni_enqueue_home_styles’)) { function ni_enqueue_home_styles() { // Base CSS for the homepage sections (scoped by…Continue reading