Can’t get serialized php array to work
-
Can’t get this to work. WPDataTables always throws a “Table in data source has no rows.” It work with $test, but cant get it to work otherwise. HELP!
<?php // get current user data global $current_user; get_currentuserinfo(); $userAuther = array('author' => $current_user->ID); $args = array('post_type' => 'property-tour','post_status' => 'any' ); // check if admin user logged in if(!current_user_can('manage_options')){ $args = array_merge($userAuther,$args); } // get all tours data $the_query = new WP_Query( $args ); // The Loop if ( $the_query->have_posts() ) { echo ''; while ( $the_query->have_posts() ) { $the_query->the_post(); ?> <?php $address = get_post_meta(get_the_ID(),'wpcf-street-address',true); $city = get_post_meta(get_the_ID(),'wpcf-city',true); $state = get_post_meta(get_the_ID(),'wpcf-state',true); $zip = get_post_meta(get_the_ID(),'wpcf-zip-code',true); $mls = get_post_meta(get_the_ID(),'wpcf-mls-if-available',true); $price = get_post_meta(get_the_ID(),'wpcf-order_total',true); $billing = (get_post_meta(get_the_ID(),'tour_payment',true)) ? "yes" : "no"; $frontend_image = (get_post_meta(get_the_ID(),'wpcf-frontend-image',true)) ? '<a href="'.get_post_meta(get_the_ID(),'wpcf-frontend-image',true).'" data-gallery="" none><img style="width:100px;" class="listing_image_tour" src="'.get_post_meta(get_the_ID(),'wpcf-frontend-image',true).'"/></a>': "N/A"; ?> $final[] = array(<?php echo get_post_status ( get_the_ID() );?> , $<?php echo $price;?> , <?php echo $billing; ?> , <?php echo get_the_author(); ?> , <?php echo get_the_date(); ?> , image , <?php echo $address;?> , (<?php echo $city;?>, <?php echo $state;?>) , 0); <?php } echo ''; /* Restore original Post Data */ wp_reset_postdata(); } else { // no posts found } //echo serialize( $final ); ?> <?php $test = array( array(0, 1, 2, 3, 4, 5, 6, 7, www.yahoo.com, word), array(3, 4, 5), array(6, 7, 8, 9), ); echo serialize( $final ); ?>The page I need help with: [log in to see the link]
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Can’t get serialized php array to work’ is closed to new replies.