Sort custom field by post

Here’s a loop that pulls all your post with the custom field key “Country”… <?php $countryPosts = new WP_Query(); $countryPosts->query(‘meta_key=country’); ?> <?php while ($countryPosts->have_posts()) : $countryPosts->the_post(); ?> CONTENT STUFF HERE <?php endwhile; ?> Now to order that you can add order=ASC or order=DESC so this line reads: $countryPosts->query(‘meta_key=country&order=ASC’); Here’s the loop that will show all … Read more

WordPress: custom field display twice

Hey guys, I found THE solution. Problems : Custom field display twice. No Ajax/jQuery visual feedback. If you’ve been working on the file function.php, make sure you remove extra line breaks. Particularly at the top and the bottom of your file… If you have some line breaks, your xml got an error : XML or … Read more

How do I modify the “Insert Media” lightbox in the admin to only show media items from a category?

I think you can go about the filter list_terms_exclusions, but i don`t tested. example: function fb_list_terms_exclusions($args) { if ( ‘media-upload-popup’ != $where ) return $where; if ( !current_user_can(‘manage_categories’) ) $where = ” AND t.slug NOT IN (‘uncategorized’, ‘category-2’)”; // slug of categories return $where; } add_filter( ‘list_terms_exclusions’, ‘fb_list_terms_exclusions’ ); update for the comments to this … Read more

user Profile meta value as custom field

create a simple query and loop over all posts with your function: //get all your post of that type my_query = new WP_Query(); my_query->query(array(‘post_type’ => ”,’posts_per_page’ => -1)); if (my_query->have_posts()){ //loop over all post and update meta field with your function while (my_query->have_posts()){ my_query->the_post(); add_custom_field_automatically_new($post->ID,$post->post_author); } } //save as your function but with bit of … Read more