Custom Taxonomy order by Custom Field

Ok so after posting the question an option to view another similar question appeared. So here is the answer if somebody is trying to do the same thing. //Using WordPress Pre-Get filter to order the custom taxonomy by custom field function customize_customtaxonomy_archive_display ( $query ) { if (($query->is_main_query()) && (is_tax(‘custom-taxonomy’))) $query->set( ‘post_type’, ‘your-post-type’ ); $query->set( … Read more

Revolution Slider Orderby Two Custom Fields

To order by event-end date or start date, your write separate function and call them as per requirement. For example if user clicks on order by start then start function should be called. switch($orderby){ case: ‘event-start’: # your code /* $query[‘meta_key’] = ‘event_start_date’; $query[‘orderby’] = ‘event_start_date’; */ break; case ‘event-end’: #your code /* $query[‘meta_key’] = … Read more

How to make custom comment fields required and message field not required

Here is a related question that should answer yours. Basicly you want to use the pre_comment_on_post hook function custom_validate_comment() { //validate for brief and rating if( empty( $_POST[‘brief’]) || empty( $_POST[‘rating’]) ) wp_die( __(‘Error: you must fill in both the rating and the brief’) ); //make comment not required if(empy($_POST[‘comment’]){$_POST[‘comment’] == “empty_comment”;} } add_action(‘pre_comment_on_post’, ‘custom_validate_comment’); … Read more

Saving multiple Metabox contents

Aha! Stupid error. I didn’t give it a proper METAKEY! This seems to have fixed things: /* Save the meta box’s post metadata. */ function save_metabox_exhibition( $post_id, $post ) { $fields = 0; if($_POST) { $metaboxes[0][‘nonce’] = $_POST[‘exhibition_finish_date_nonce’]; $metaboxes[0][‘data’] = $_POST[‘gc_finish_date’]; $metaboxes[0][‘meta’] = ‘gc_finish_date’; $metaboxes[1][‘nonce’] = $_POST[‘exhibition_start_date_nonce’]; $metaboxes[1][‘data’] = $_POST[‘gc_start_date’]; $metaboxes[1][‘meta’] = ‘gc_start_date’; $metaboxes[2][‘nonce’] = … Read more

How to set default metaboxes on user creation?

Based on this Answer by t31os. Here, all meta boxes are being set to invisible, so simply remove from the array the ones that are meant to be visible. add_action(‘user_register’, ‘wpse_58645_set_user_metaboxes’); function wpse_58645_set_user_metaboxes( $user_id ) { update_user_meta( $user_id, ‘metaboxhidden_post’, array( ‘authordiv’, ‘categorydiv’, ‘commentstatusdiv’, ‘formatdiv’, ‘postcustom’, ‘postexcerpt’, ‘postimagediv’, ‘slugdiv’, ‘tagsdiv-post_tag’, ‘trackbacksdiv’, ) ); } For registered … Read more

Custom Fields Bulk Edit

FIRST BACKUP!!!!! NEXT, BE SURE THE BACKUP IS RIGHT Now, you can use this code in PHPMyAdmin UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ‘preview’, ‘edit’) WHERE meta_key = ‘dp_video_code’ Make sure that’s the correct name of the custom field, you can check it in the wp_postmeta table.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)