Sending a custom form data in email through WP Mail Function

I would suggest using AJAX for this. You could do something like this for the jQuery part: <script type=”text/javascript”> jQuery(document).ready(function($) { // Execute when user clicks on the “Submit” button $(‘#SUBMIT_BUTTON_ID’).on(‘click’, function(e) { e.preventDefault(); var email = $(‘input[name=email]’).val(); var firstname = $(‘input[name=firstname]’).val(); var familyname = $(‘input[name=familyname]’).val(); var other_names = $(‘input[name=other_names]’).val(); var dob_day = $(‘input[name=dob_day]’).val(); var … Read more

Issue with php version 7.2 in running search

I’m going to guess that PHP’s settings have changed with the upgrade. Division by zero suggests some variable is not initialized (and is being dynamically typed as 0). The PHP manual has a lot of information on the changes between 5.x and 7.x. This bit on how variables are handled supports my hypothesis, especially if … Read more

update_post_meta on multi-dimensional array options

You can’t, get_post_meta and its associated APIs all work on key/value pairs, you can update the value, but you can’t update a sub-section of it. You have to retrieve the entire value, modify it, then put it back as a whole. Additionally, values are always strings, so to make this work WordPress will PHP serialize … Read more

What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?

PHP is running on the server, JavaScript in the client. This means PHP is faster (more resources), the result can be cached, and you have to test only one interpreter. JavaScript – you don’t really need jQuery for this – is more error prone, because of weird clients, blocked resources, or a more limited available … Read more

get taxonomy thumbnail and use it as a variable in code

You have ‘taxonomy’ => ‘product_cat’ in your code, so most likely you have Woocommerce, and we need to get a category picture from there. Try this code <?php $args = array( ‘taxonomy’ => ‘product_cat’, ‘title_li’ => ”, ‘hide_empty’ => 0, ‘echo’ => 0, ‘show_count’ => 0, ‘style’ => ”, ‘parent’ => 0 ); $get_cats = … Read more

What is the latest WordPress that will work on PHP 5.2.17?

I think you’re looking at this the wrong way. Having an old application that requires such a archaic PHP version is bad enough. That does not mean, your new WordPress installation needs to use that same old version though. Instead, I would suggest to keep PHP 5.2.17 for the legacy application and use the latest … Read more

How to parse multiple links from one variable?

I would look into this question here https://stackoverflow.com/questions/36564293/extract-urls-from-a-string-using-php You could use the above link detection to do something like this in your shortcode: <?php function pods_current_user($atts) { extract(shortcode_atts(array( ‘currUser’ => get_current_user_id(), ), $atts)); extract(shortcode_atts(array( ‘field’ => “display_name”, ), $atts)); $message = do_shortcode(‘[pods name=”user” where=”ID = ‘.$currUser.'”] {@’.$field.’}[/pods]’); preg_match_all(‘#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#’, $message, $match); // Do something with your … Read more

wp_query get the 2nd post

I figured out you can use ‘offset’ => 1, to skip 1 post and get the 2nd. Change the number to however many posts you want to skip. ie. set it to 2 to get the 3rd. $loop = new WP_Query( [ ‘post_type’ => ‘product’, ‘posts_per_page’ => 1, ‘offset’ => 1, ‘meta_key’ => ‘total_sales’, ‘orderby’ … Read more