Add a field into a shortcode of an extension

to customise the complete result of the shortcode, you can try this code which redefine the shortcode : add_action(“plugins_loaded”, function () { if (!isset($GLOBALS[“shortcode_tags”][“wpneo_crowdfunding_form”])) { return; } $original_callback = $GLOBALS[“shortcode_tags”][“wpneo_crowdfunding_form”]; add_shortcode( “wpneo_crowdfunding_form” , function ($attr, $content, $tag) use ($original_callback) { $original_result = $original_callback($attr, $content, $tag); // customise the HTML result of the form $original_result = … Read more

Check if a value exists in database table

Replace this: $result = $wpdb->get_row(“SELECT * FROM wp44_predefined_address WHERE ‘UPPER(Address1)’ LIKE ‘UPPER(%s)'”, $myinput); with this: (just choose the appropriate $like based on your requirements) // Properly generate the LIKE query. $like=”%” . $wpdb->esc_like( $myinput ) . ‘%’; // e.g. ‘%input%’ //$like=”%” . $wpdb->esc_like( $myinput ); // e.g. ‘%input’ //$like = $wpdb->esc_like( $myinput ) . ‘%’; … Read more

Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]

The meta box template for the variations is defined in the file html-variation-admin.php. There you will find the hook “woocommerce_variation_options_pricing”. With this hook you can add your input field to the desired place. function variation_settings_fields($loop, $variation_data, $variation) { // Your Text Field woocommerce_wp_text_input( array( ‘id’ => ‘_text_field[‘ . $variation->ID . ‘]’, ‘label’ => __(‘My Text … Read more

woocommerce related product title length

Problem solve based on this article https://designsmaz.com/how-to-short-woocommerce-products-title/#comment-76957 Basically I just replace the <?php the_title(); ?> to <?php $shorttitle = mb_substr(the_title(”,”,FALSE),0,45); echo $shorttitle; if (strlen($shorttitle) >44){ echo ‘&hellip;’; } ?>

How to use mysql LIKE with wpdb?

According to the Codex, the delete method will not accept the LIKE operator. You’ll be better off just using the query method. $query = $wpdb->prepare(“DELETE FROM $wpdb->posts WHERE post_type=”flamingo_inbound” AND post_content LIKE %s”, ‘%’.$mail.’%’); $wpdb->query($query); Hopefully $mail doesn’t have a % or _ character otherwise you need to escape it before you build $querylike so: … Read more

WP All Import / Update stock quantity from multiple XML files

I managed to get it working, here is answer: – when importing update new stock to custom field: _custom_stock_placeholder – update only this field: _custom_stock_placeholder – add this code to functions.php add_action(‘pmxi_saved_post’, ‘post_saved’, 10, 1); function post_saved($id) { $original_stock = get_post_meta($id, ‘_stock’, true); $new_stock = get_post_meta($id, ‘_custom_stock_placeholder’, true); $combined_stock= $original_stock + $new_stock; update_post_meta($id, ‘_stock’, $combined_stock); … Read more

Native gallery custom html output

Is this what your looking for, here? get_post_gallery_images(). This is the example for that page. add_filter( ‘the_content’, ‘wpdocs_show_gallery_image_urls’ ); /** * Show image URLs below the content */ function wpdocs_show_gallery_image_urls( $content ) { global $post; // Only do this on singular items if( ! is_singular() ) return $content; // Make sure the post has a … Read more

400 Bad Request – JavaScript App calling Custom wp-json endpoint

There were three problems I discovered with my code above. First, $_SERVER[“HTTP_REFERRER”]; is an undefined index, moreover it is mispelled – HTTP_REFERER would be correct if it could be accessed this way in WP. I found get_http_origin() instead. $data[‘UrlReferer’] = get_http_origin(); Second, I also mispelled the field I was saving this variable to – UrlReferrer … Read more