How to randomise my menu items?

Ehm, afaik the return value of the menu fn is an object: You need to type cast earlier $menu_items = (array) wp_get_nav_menu_items( 26 ); // Typecast here $menu_items = array_rand( $menu_items, 3 ); foreach ( $menu_items as $key => $menu_item ) { echo $menu_item[‘title’]; }

Show array of meta_value in Edit Post Coloum

The error was here: (Thank you @Rarst) if ($column_name == ‘custom_checkbox_group_sesso’) { $sesso_occupanti = get_post_meta($post_ID, “custom_checkbox_group_sesso”, true); //check that we have a custom field if ($sesso_occupanti != “”) { // Separate our comma separated list into an array $sesso_occupanti = explode(“,”, $sesso_occupanti); //loop through our new array foreach ($sesso_occupanti as $sesso) { echo $sesso ; … Read more

meta_query returning excluded result

i’m not sure about this one, but i think you have too many nested arrays. you should be getting something like [meta_query] => Array ( [relation] => OR [0] => Array ( [key] => _cmb_tuesday_location_1 [value] => huntley [compare] => LIKE ) [1] => Array ( [key] => _cmb_tuesday_location_2 [value] => huntley [compare] => LIKE … Read more

Add formatting to Array

I’m finding it a little hard to follow based on your comments, however if you want to add a <div> around each other then change your second foreach statement to; foreach ($uc as $key => $value) { $user = get_userdata($key); $post_count = get_usernumposts($user->ID); if ($post_count) { $author_posts_url = get_author_posts_url($key); echo ‘<div class=”class-name-here”>’; echo ‘<li><a href=”‘ … Read more

Custom field to array?

I will assume that you(or users) will enter post ids into a posts custom field, comma separated, eg: 11,13,34,54 OR 11, 13, 34, 54. Then all you need to do is get the custom field value for the loaded post, explode the custom field value by comma(,): and, then you’ll have a nice array to … Read more