Storing a DateTime Value in a Sortable Custom Field?

Yes, you can use jQuery DatePicker and save the date, and use query_post to show the postS in order (code also on github): <?php //The Query // exactly than query_posts(‘meta_key=start_date&meta_value=”.date(“Y-m-d”)); // or // dates less than // query_posts(“meta_key=start_date&meta_compare=<=&meta_value=”.date(“Y-m-d”)); // or // date mayor than // query_posts(“meta_key=start_date&meta_compare=>=&meta_value=”.date(“Y-m-d”)); //The Loop if ( have_posts() ) : while ( … Read more

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.

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

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