MySQL query in WordPress with AJAX

I would need to see your trigger function but it sounds like you just need to add event.preventdefault to the submit. This will block the page load while still executing AJAX. $(“form.searchCV_form”).submit(function(event){ event.preventDefault(); alert( “We’re not going anywhere now…” ); // j$.post… }); or $(“form.searchCV_form”).submit(function(e){ alert( “We’re not going anywhere now…” ); // j$.post… return … Read more

the_post_thumbnail(); only works with fullsize images

You have to tell WP to generate this image sizes at first… Use function add_image_size and then “regenerate the thumbnails”: add_image_size( ‘custom-size’, 220, 180, true ); // 220 pixels wide by 180 pixels tall, hard crop mode Note “custom-size” string which could be anything you want. https://developer.wordpress.org/reference/functions/add_image_size/ After that you can use the the_post_thumbnail function … Read more

Submitting my form to the database and then redirecting to payment site

Good afternoon, I managed to sort this out. I have amended my functions.php to the following. function mcPaySubmit(){ global $wpdb; include(‘paygate.php’); $last = wp_get_recent_posts(array(‘numberposts’ => ‘1’, ‘post_type’ => ‘post’, ‘post_status’ => ‘pending’, ‘author’ => $user_id)); $purchase_post_id = $last[‘0’][‘ID’]; $purchase_days = $_POST[‘dext’]; $purchase_date = $_POST[‘mcTransactionDate’]; $purchase_amount = $_POST[‘totalDue’]; if($wpdb->insert(‘ac_purchases’, array( ‘purchase_post_id’ => $purchase_post_id, ‘purchase_days’ => $purchase_days, … Read more

Filtered table in wordpress

Ok I got my answer if($char) { $results = $wpdb->get_results( “SELECT * FROM teacher_directory where Name LIKE ‘$char%'”, ARRAY_A ); if(!empty($results)) { //Printing the table here } }

Renaming “Expand Details” within “Add Media”

It’s possible to change the output of the label with jQuery but I’m not sure the best hook to do this besides admin_footer. // Collapse var $open = jQuery(‘.acf-expand-details > .is-open’), $open_icon = $open.find(‘span’); $open.html(‘MIN Details –>’); $open.prepend($open_icon); // Expand var $close = jQuery(‘.acf-expand-details > .is-closed’), $close_icon = $close.find(‘span’); $close.html(‘<– MAX Details’); $close.prepend($close_icon); add_action( ‘admin_enqueue_scripts’, … Read more