How to Sort by Date When Using d-m-Y Format

You need to extend the MySQL-Query directly, as you have to use the MySQL-Function STR_TO_DATE in order to not mess with the pagination etc. You should be able to achieve this with a change in your pre_get_posts like this: add_action( ‘pre_get_posts’, ‘courses_columns_orderby’ ); function courses_columns_orderby( $query ) { if( ! is_admin() ) return; $orderby = … Read more

Best way to allow manageable social media URLS?

The best way is on the user profile page using the contact methods extension: add_filter( ‘user_contactmethods’, ‘more_contactmethods’ ); function more_contactmethods( $contactmethods ) { $contactmethods[‘twitter’] = ‘Twitter username’; $contactmethods[‘facebook’] = ‘Facebook URL’; return $contactmethods; } This adds fields to the user profile page for those social networks. You can have as many as you like, then … Read more

How can I customize “Pages” admin (edit.php) and “Edit Page” admin (post.php) for bulk edit of custom content type?

Do not edit core files. . 1. Assuming you have a registered a custom post type called biblio, you can add and remove “stuff” within your functions.php. For instance this removes some meta boxes from ‘biblio’ function remove_default_page_screen_metaboxes() { global $post_type; remove_meta_box( ‘commentstatusdiv’,’biblio’,’normal’ ); // Comments Metabox remove_meta_box(‘commentsdiv’,’biblio’,’normal’); // Comments remove_meta_box( ‘trackbacksdiv’,’biblio’,’normal’ ); // Talkback … Read more

How to Sort Custom Field Admin Column by Date

The function add_sortable_date_column only registers columns as sortable. Add one more function to tell wordpress how to sort your columns. function courses_columns_orderby( $query ) { if( ! is_admin() ) return; $orderby = $query->get( ‘orderby’); switch( $orderby ){ case ‘online_start’: $query->set(‘meta_key’,’online_start’); $query->set(‘orderby’,’meta_value’); break; default: break; } } add_action( ‘pre_get_posts’, ‘courses_columns_orderby’ );

WordPress query by multiple Custom fields and order by date

@Uffo I would say your args are wrong, should be something like: $args = array( ‘post_type’ => ‘Event’, ‘posts_per_page’ => 1000, ‘meta_query’=> array( array( ‘key’=>’event_informations_show_on_the_homepage’, ‘value’=> ‘Show on the homepage’, ‘compare’ => ‘==’ ) ), ‘meta_key’=>’event_informations_date’, ‘orderby’=>’meta_value_num’, ‘order’=>’ASC’ ); The way you did it, it’s just the last meta_key that will be used both for … Read more

How to reload the role specific registration form on validation errors?

You can either user session or cookies to setup the user for the desired role e.g: /** * register_roles_with_cookies */ class register_roles_with_cookies { function __construct($args = array()){ //create a hidden field for role and extra fields needed add_action(‘register_form’,array($this,’add_hidden_role_field’)); //validate add_action(‘register_post’,array($this,’my_user_fields_validation’),10,3); //save the role add_action(‘user_register’, array($this,’update_role’)); } public function setCookie($name,$val,$time = false){ if(false === $time) $time … Read more

Determine when a custom field was last updated?

I would add another custom field that stores the update time. Then create an add_action function for update_post_meta to also save the timestamp at the same time you write to CUSTOMFIELD. The action triggered when adding a custom field is add_post_meta and when updating a custom field update_post_meta

Create ul list in Custom Meta Box?

You can add your information in regular metabox textarea and separate prospective list items with new line. Then just format it as list in your template: <?php $list_items = get_post_meta($post->ID, ‘your_custom_field_name’, true); if($list_items){ $list_items = explode(“\n”, $list_items) echo ‘<ul>’; foreach($list_items as $list_item) { echo ‘<li>’ . $list_item . ‘</li>’; } echo ‘</ul>’; } Or you … Read more

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