WP_Query based on multiple metadata comparisons

You could split this into two WP_Querys: $args = array( ‘post_type’ => ‘match_report’, ‘post_status’ => ‘publish’, ‘meta_key’ => ‘report_type’, ‘meta_value’ => ‘cup’, ‘fields’ => ‘ids’ ); $reportsPre = new WP_Query($args); $post_IDs = array(); if(isset($reportsPre->posts) && !empty($reportsPre->posts)){ foreach((array) $reportsPre->posts as $id) { $post_IDs[] = $id; } } $args2 = array( ‘post__in’ => array($post_IDs), ‘meta_query’ => array( … Read more

Post Title Not showing up

Add: $first_attachment = reset($attachments); $first_attachment_id = $first_attachment->ID; $first_attachment_title = $first_attachment->post_title; Below: $nbImg = count($attachments); Now you are able to return the link with: echo wp_get_attachment_link( $first_attachment_id, ” , true, false, $first_attachment_title ); If you need a sort of custom link markup, you can have a look at the related functions: http://codex.wordpress.org/Function_Reference/wp_get_attachment_link Edit: There is no … Read more

Dynamically name array in WordPress loop – add/get values

From the PHP manual: Variable names follow the same rules as other labels in PHP. A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: ‘[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*’ Hence before diving into your code further: It would need much … Read more

Why isn’t my Meta_Query running?

If you haven’t assigned it to any hook and you don’t call it, then it can’t work – this function is never called. You should assign it to pre_get_posts hook, I guess (at least it looks so). Add this after your function: add_filter( ‘pre_get_posts’, ‘ah_meta_queries’ ); It should work fine then.

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