Query multiple meta values at the same time :

You’ll need to change your search form, PHP uses fieldname[] notation to accept multiple values for a parameter name. <input type=”checkbox” name=”modele_du_processeur[]” value=”Core i3″ /> <input type=”checkbox” name=”modele_du_processeur[]” value=”Core i5″ /> <input type=”checkbox” name=”modele_du_processeur[]” value=”Core i7″ /> Once that’s done, you will get an array in $_GET[“modele_du_processeur”], so you can work with $args = array( … Read more

Sorting post by custom fileds date

Here is the Code function university_adjust_queries( $query ) { if ( ! is_admin() && is_post_type_archive( ‘program’ ) && $query->is_main_query() ) { $query->set( ‘orderby’, ‘title’ ); $query->set( ‘order’, ‘ASC’ ); $query->set( ‘posts_per_page’, -1 ); } if ( ! is_admin() && is_post_type_archive( ‘event’ ) && $query->is_main_query() ) { $today = date( ‘Ymd’ ); $query->set( ‘meta_key’, ‘event_date’ ); … Read more

Hide custom fields by user’s role

You can use the current_user_can() function to test the current user’s role. I would also recommend making the custom field protected by default and allowing access only to the proper users. In theory, something like this should work: function my_exclude_custom_fields( $protected, $meta_key) { if ( in_array( $meta_key, array( ’email’, ‘text’ ) ) ) { if … Read more

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