/** * Validate Number Slider on submit and require a non-zero value. * * Runs after the form is submitted and before processing completes. * * @param int $field_id Current field ID being validated. * @param mixed $field_submit Submitted value.…Continue reading
add_filter( ‘wpforms_emails_mailer_get_attachments’, function( $attachments, $mailer ) { // Get the uploads directory path. $upload_dir = wp_upload_dir(); // Add your custom file path(s) $file_url = ‘/path/to/your/file.pdf’; // Convert URL to local file path. $file_path = str_replace( $upload_dir[‘baseurl’], $upload_dir[‘basedir’], $file_url ); //…Continue reading
/** Update ACF age field based on WPForms checkbox submission. @param int $post_id Post ID. @param array $fields Sanitized entry field values/properties. @param array $form_data Form settings/data. @param int $entry_id Entry ID. @return void */ function wpf_dev_update_age_field_from_submission( $post_id, $fields, $form_data,…Continue reading
/* shrinking header section */ .shrinker { background: transparent; height: (set your header height in pixels); transition: all .2s linear!important; -webkit-transition: all .2s linear!important; -moz-transition: all .2s linear!important; } .shrinker.elementor-sticky–effects { background: #fff; height: (set your header height after shrinking…Continue reading
// Site name add_shortcode(‘site_name’, function () { return get_bloginfo(‘name’); }); // Home URL (front-end URL) add_shortcode(‘site_url’, function () { return esc_url(home_url(‘/’)); }); // Clickable site link: [site_link text=”My Site”] add_shortcode(‘site_link’, function ($atts) { $a = shortcode_atts([‘text’ => get_bloginfo(‘name’)], $atts); return…Continue reading
// Shortcode function to display ACF field from options function display_acf_option_shortcode($atts) { // Parse attributes with defaults $atts = shortcode_atts(array( ‘field’ => ”, // Default field (leave empty or set fallback) ), $atts); // Check if field is provided if…Continue reading
add_action(‘add_meta_boxes’, function() { add_meta_box( ‘custom-logo-metabox’, ‘Custom Logo’, function($post) { // Add a nonce field so we can check for it later wp_nonce_field(‘custom_logo_meta_box’, ‘custom_logo_meta_box_nonce’); // Retrieve the existing value from the database $custom_logo_id = get_post_meta($post->ID, ‘_custom_logo_id’, true); $custom_logo_url = $custom_logo_id ?…Continue reading
/** * Change number of products that are displayed per page (shop page) */ add_filter( ‘loop_shop_per_page’, ‘new_loop_shop_per_page’, 20 ); function new_loop_shop_per_page( $cols ) { // $cols contains the current number of products per page based on the value stored on…Continue reading
// === SCHEMA: define every shortcode, its params, and internal template === $shortcode_schemas = [ ‘faqs’ => [ ‘description’ => ‘Expandable FAQ section.’, ‘parameters’ => [], ‘_internal’ => [ ‘template_id’ => 3676 ], // INTERNAL ONLY ], // [faq faqs='[{“question”:”…”,”answer”:”…”}]’]…Continue reading
// This creates an avater Shortode function bb_logged_in_user_avatar_shortcode($atts) { if (is_user_logged_in()) { $current_user = wp_get_current_user(); $avatar = get_avatar($current_user->ID, 96); // 96 is the size in pixels return $avatar; } else { return ”; } } // This creates an USER…Continue reading