May 31, 2016

PHP array_filter trim is not working as callback

PHP array_filter trim is not working as callback Have you tried this? $arr = array_filter($arr, ‘trim’); Solution: $arr = array_filter(array_map(‘trim’, $arr));  

May 24, 2016

Gravity Forms API Functions

Gravity Forms API Functions https://www.gravityhelp.com/documentation/article/api-functions/ https://www.gravityhelp.com/documentation/article/api-functions/#get_entries Gravity Forms Hooks https://www.gravityhelp.com/documentation/article/gform_after_submission/ Gravity Forms Notification/Email Hook https://www.gravityhelp.com/documentation/article/gform_notification/   gform_pre_validation function unrequire_fields( $form ) { $ignore = array(1); foreach( $form[‘fields’] as &$field ) { if(in_array($field->id, $ignore)){ $field[‘isRequired’] = false; } } add_filter( ‘gform_pre_validation’, ‘unrequire_fields’ );

May 22, 2016

wordpress shortcode to force return instead of output

wordpress shortcode to force return instead of output https://codex.wordpress.org/Shortcode_API function my_shortcode() { ob_start(); ?> <HTML> <here> … <?php return ob_get_clean(); }

May 16, 2016

PHP Function ksort to recursive_ksort

PHP Function ksort to recursive_ksort function recursive_ksort(&$array) {     if (is_array($array)) {         ksort($array);         array_walk($array, ‘recursive_ksort’);     } } An important thing in this function is variable by reference instead of returning value each time. So its easy to understand for those guys who worked in C language and a little difficult for routine […]

May 12, 2016

WordPress helper function checked

WordPress helper function checked Older Method: <input type=”checkbox” id=”tutorsloop_share” name=”wpe_sharing[social_options][]” value=”tl” <?php echo  in_array( ‘tl’, $opts[‘social_options’] )?’checked=”checked”‘:”; ?> /> Preferred Method: <?php checked( in_array( ‘tl’, $opts[‘social_options’] ), true ); ?> <input type=”checkbox” id=”tutorsloop_share” name=”wpe_sharing[social_options][]” value=”tl” <?php checked( in_array( ‘tl’, $opts[‘social_options’] ), true ); ?> /> Click here for details on WordPress.org Click here for screenshots