How to sort by custom field value?

From what I understood from your question, you want to sort your result by the most rated custom field ‘rating’ which is assumed to be number. In order to do this you need to write the below wp_query argument and to handle it properly in your request. However the end result for your query should … Read more

How to change order of posts in admin

Adding Columns to Admin To answer your first question, I recommend a plugin called Codepress Admin Columns. This is by far one of the easier and non-coding ways to implement columns. But it will set you back 15EUR to purchase the add-on that allows sorting. If you wish to get your hands dirty with code … Read more

Problem uploading different files as custom fields with front end post form

For starters, the ‘post_category’ argument only accepts category ID’s, so you will have to find that through your database, or through get_category_by_slug: $cat = get_category_by_slug( ‘music’ ); $cat_id = $cat->term_id; Secondly, look at your wp_handle_upload() section. You are passing $file[‘file’] in both cases, where ‘file’ is not the name of either of your upload fields. … Read more

Adding extra fields to front end signup form

You can read a somewhat extensive tutorial over at: http://www.cozmoslabs.com/1012-wordpress-user-registration-template-and-custom-user-profile-fields/ Basically this is what you’re going to be using to add them to the backend: add_action( ‘show_user_profile’, ‘show_extra_profile_fields’, 10 ); add_action( ‘edit_user_profile’, ‘show_extra_profile_fields’, 10 ); function show_extra_profile_fields( $user ) { ?> <input type=”text” name=”twitter” value=”<?php echo esc_attr( get_the_author_meta( ‘twitter’, $user->ID ) ); ?>” /> <?php … Read more

WP_Query () using taxonomy, custom post types

<?php $args = array( ‘post_type’ => ‘care-agency’, ‘meta_key’ => ‘wpcf-listtype’, ‘meta_value’ => ‘Enhanced Listing’ ); $loop = new WP_Query( $args); if ( $loop->have_posts() ) { while ( $loop->have_posts() ) : $loop->the_post(); //Here goes my loopy stuff endwhile; } All taken from the codex on WP_Query.