I am not getting result from php function that is json encoded
I am not getting result from php function that is json encoded
I am not getting result from php function that is json encoded
A quick solution would be to change this: //rename the array keys foreach( $data as &$new_values ) { $new_values[‘user_id’] = $new_values[0]; unset( $new_values[0] ); $new_values[‘product_id’] = $new_values[1]; unset( $new_values[1] ); } Into this: //rename the array keys foreach( $data as &$new_values ) { $new_values[‘user_id’] = (string) $new_values[0]; unset( $new_values[0] ); $new_values[‘product_id’] = (string) $new_values[1]; unset( … Read more
get_the_ID gives you the ID of the current post, but at no point during that loop do you change what the current post is. It’s always the last post processed in the previous loop because that’s the last time you called the_post(). This is why you always get the same ID. Instead, store the ID: … Read more
I played with the code for a bit longer and managed to get it working. Answer below add_filter( ‘gform_pre_render’, ‘freetrial_studios’ ); add_filter( ‘gform_pre_validation’, ‘freetrial_studios’ ); add_filter( ‘gform_pre_submission_filter’, ‘freetrial_studios’ ); add_filter( ‘gform_admin_pre_render’, ‘freetrial_studios’ ); function freetrial_studios( $form ) { foreach ( $form[‘fields’] as &$field ) { if ( $field->type != ‘select’ || strpos( $field->cssClass, ‘studio-list’ ) … Read more
Add custom filter to register data in array
The reason you get the “First” Array is that you don’t use the “single” option of the get_user_meta function. Try this: $arr = get_user_meta($user->ID, ‘wpcf-team-experience-member-type’,true); $options = array(); if(is_array($arr)){ foreach($arr as $key => $value){ foreach($value as $arrvalue){ $options[] = $arrvalue; } } } var_dump($options); This should dump all the options that maybe are in there. … Read more
Managed to find a solution that display the array correctly: $attachments = get_children( array( ‘post_parent’ => get_the_ID(), ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_status’ => ‘inherit’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order ASC’ ) ); $imgArray = array(); $counter = 0; foreach ( $attachments as $attachment_id => $attachment ) { $imgArray[$counter] = … Read more
I believe showposts as been depreciated in favor of posts_per_page $args = array( ‘posts_per_page’ => 3, ‘tag_slug__and’ => array(‘morning-meat’) );
Display result from custom post meta query
You’ve left something out of the description– namely, it isn’t clear how/where you load that code. I am guessing you are pushing things through a template file somehow, or through a backend plugin file maybe, as you have what looks like template code showing up. You should instead, in my opinion, be using the AJAX … Read more