WordPress

August 23, 2018
Change Value Based on Date/Time Selections

The form below has a date field, a time field, and a numerical field. Using JavaScript, I've made a change in the time field trigger code to check if the time is less than 24 hours in the future. This can be used to add a premium to last-minute bookings, disable submission, whatever you need […]

January 24, 2018
SQL Query to Update Forgotten Password in WordPress

It's pretty simple. You just execute the following query: UPDATE `wp_users` SET `user_pass`= MD5('PASSWORD_HERE') WHERE `user_login`='USERNAME_HERE'; You could also go: UPDATE `wp_users` SET `user_pass`= MD5('PASSWORD_HERE') WHERE `ID`='ID_HERE'; Or: UPDATE `wp_users` SET `user_pass`= MD5('PASSWORD_HERE') WHERE `user_email`='EMAIL_HERE'; Etc., you get the idea. Whatever field you use as your identifier, make sure the values are unique. There are […]

January 22, 2016
Encode an Email Address so spambots don't grab it

/** throw this in your child theme's "functions.php" file * Encode an email address to display on your website * converts the address to ASCII character codes * that the browser displays fine but most spambots can't decipher. * * usage: [encode_email email="you@yourdomain.com"] * */ add_shortcode('encode_email','encode_email_address'); function encode_email_address( $atts ) { $atts = shortcode_atts( array( […]

January 4, 2016
remove empty array elements

Easy peasy: $newArray = array_filter($array); What if they aren't truly empty, but contain blanks, you ask? $trimmedArray = array_map('trim', $array); $newArray = array_filter($trimmedArray);

January 4, 2016
trim all elements in an array (remove leading and trailing spaces)

Remember array_map? That handy-dandy function that lets process every element of an array using a function? It's so simple, yet I always forget this one and need reminding: $result = array_map('trim', $source_array); Array_map has many other potential uses as well ...

November 17, 2015
Set number of rows for repeating section

Sometimes you have a Search form with a repeating section in it, and are using 'frm_get_default_value' to populate it, but the darn thing won't show the right number of rows. This fixes it. add_filter( 'frm_repeat_start_rows', 'frm_set_ten_rows', 10, 2); function frm_set_ten_rows( $row_num, $field ){ if ( $field['id'] == 157 && isset($_REQUEST['depdob']) ) { // change 157 […]

October 26, 2015
Calculate Difference in Years Between Two Dates using a shortcode

Sometimes you need to calculate a person's age on the fly, but on a given date, not today's. This is especially useful in Formidable Pro Views, where you can use Formidable shortcodes to populate the date variables. /******************************************************************************** * erentzen@gmail.com * function calculate_years_diff($atts = array( 'birthdate' => 'Y-m-d','effective' => 'Y-m-d') * calculates difference in years […]

October 26, 2015
Use a mySQL Query to delete all entries in a Formidable Form

Sometimes a form has thousands of entries, or even tens of thousands. Deleting them manually via the admin interface is a bit much in these circumstances, since you can only do up to 999 at a time this way. You can use PHPmyAdmin or a similar database tool to do it all in one fell […]

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

Email sending image

You have Successfully Subscribed!