How to List Events by Year and Month Using Advanced Custom Fields?

This should get you started: <?php $the_query = new WP_Query( array( ‘post_type’ => ‘kalender_item’, ‘post_status’ => ‘publish’, ‘meta_key’ => ‘kalender_item_datum’, ‘orderby’ => ‘meta_value’ ) ); # This will hold what group we’re in $current_header=””; # The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); # get the datum for this post $temp_date = get_post_meta( get_the_ID(), ‘kalender_item_datum’, … Read more

How to uniquely identify queries?

tl;dr: build affordable unique identifiers for queries is possible, but is pretty useless. If you’re looking for unique identifiers for query objects, then you can use spl_object_hash, but IMHO is pretty useless: it is non-predictable, and also you get different id even if query vars are identical, but set on 2 different query objects. Only … Read more

wpdb get posts by taxonomy SQL

Sorry guys, I just found the solution: SELECT p.post_name, t.name as clientName FROM $wpdb->posts AS p INNER JOIN $wpdb->term_relationships AS tr ON (‘p.ID’ = tr.object_id) INNER JOIN $wpdb->term_taxonomy AS tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) INNER JOIN $wpdb->terms AS t ON (t.term_id = tt.term_id) WHERE p.post_status=”publish” AND p.post_type=”portfolio” AND tt.taxonomy = ‘clients’ ORDER BY p.post_date DESC … Read more

Create pagination and order according to alphabet

i wrote about something similar recently, maybe it could be helpful to you: http://www.kathyisawesome.com/424/alphabetical-posts-glossary/ it was based off of my answer to this question: Group Posts by First Letter of Title the answer includes both my original posts_where solution and an alphabetical “menu” that for some reason i didn’t write about in my tutorial

Sort posts by category name and title

To get them broken down by Category, you need to loop through the list of categories and then query on each category: $categories = get_categories( array (‘orderby’ => ‘name’, ‘order’ => ‘asc’ ) ); foreach ($categories as $category) { echo “Category is: $category->name <br/>”; $catPosts = new WP_Query( array ( ‘category_name’ => $category->slug, ‘orderby’ => … Read more

Meta Query with AND & OR?

Sorry, doesn’t work that way. The “simple” meta parameters are converted into part of the meta_query as a whole. So it’s not a separate thing, and your OR relation applies to it as well. Your query thus is not possible with the normal query system, because you want to mix ANDs with ORs (you want … Read more

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