PHP drop down menu for my get_category child of

You can use the function wp_dropdown_categories() instead of wp_list_categories(), if you dont need to use the list function. wp_dropdown_categories() seems to be working just like the list function. So first just try and replace these two functions. $terms = wp_dropdown_categories( array( … Read about it in the codex here.

Getting a value from a custom field from a page that shares a parent with the current page

I’m assuming there are only two children in such cases. <?php $child_id = $post->ID; if ( $post->post_parent ) { $args = array( ‘post_parent’ => $post->post_parent, ‘post_type’ => ‘page’, ‘numberposts’ => -1, ‘post_status’ => ‘publish’ ); $children = get_children($args); if(count($children) == 2) { $child_id = $children[0]->ID == $post->ID ? $children[1]->ID : $children[0]->ID; } } if ( … Read more

How can get all users by current user meta (array)?

This a:1:{i:0;s:1:”3″;} is the serialized version of an array in PHP. You can unserialize it by using the function unserialize like below- $data = unserialize(‘a:1:{i:0;s:1:”3″;}’); So after unserialize inside $data you’ll get an array like below- Array ( [0] => 3 ) This array will contain the user ID which is blocked by the user … Read more

wp_query beginner

After you create your custom query, you just write The Loop as you would for the default query. So your code would look like this: if ( $query->have_posts() : while ( $query->have_posts() ) : $query->the_post(); // Your Post Stuff Goes Here endwhile; wp_reset_postdata(); else : // No Posts Found Code Goes Here endif; Note the … Read more