Display a CPT based on a metabox selection

I got it to work by using the following code function get_gas_options($a) { $args = array( ‘post_type’ => ‘fleet’, ‘orderby’ => ‘ID’, ‘post_status’ => ‘publish’, ‘order’ => ‘ASC’, ‘posts_per_page’ => -1 // this will retrive all the post that is published ); $result = new WP_Query( $args ); $title_list[”] = “Assign a Vehicle”; if ( … Read more

Sorting table function default

You can sort this by adding ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, into the $transaction_params array. and if not working change ‘suppress_filters’ => true, See reference: here Thank you.

Remove Body Classes

One (untested) suggestion is to replace: unset( $classes[array_search($body_classes, $classes)] ); with $classes = array_diff( $classes, wp_parse_slug_list( $body_classes ) ); assuming the classes survive sanitize_title from wp_parse_slug_list(). It should also be alright with empty arrays. We also note that wp_parse_slug_list() is using wp_parse_list() to parse the comma separated string.

Stuck with a Custom Field Check box Array

It’s a serialized string. Use Unserialize to get an array out of this. Also checkout WP’s maybe_unserialize method. <?php $string = “s:19.a:1:{i:0;s2”; //Using WP maybe_unserialize $result1 = maybe_unserialize($string); //Using PHP unserialize $result2 = unserialize($string); echo “<pre>”; print_r($result1); print_r($result2) echo “</pre>”; ?> $result will hold what you want.

How to store multiple values in 1 meta_key with radio input?

John, I’m not sure how you have the radio button set up, but WordPress easily handles multiple values in one meta_key. You simply need to place the values in an array before sending it to update_post_meta. For instance: $array = array( ‘foo’ => ‘foo_value’, ‘bar’ => ‘bar_value’ ); update_post_meta( $id, ‘my_meta_key’, $array ); WordPress automatically … Read more