Exclude first 2 posts with meta_key from loop

First point is that you should NOT use query_posts() for custom queries. The better approach is to use the WP_Query class. More info in the WP docs and here. This example will display your 2 featured posts and then exclude them in the second query. // We will push the ID of your featured posts … Read more

Separate Posts and Custom Post Type in Custom Taxonomy archive template

Going from memory this should work for posts <?php $query1 = new WP_Query( array( “post_type” => “post”, “tag” => $term->slug) ); ?> The first query will only return posts that have been tagged [TEAMNAME] (as far as I can remember custom taxonomies can show up as tags on a post). This should work for teams … Read more

Display custom post types with custom date field value (before today) & order by custom date field

I prefer to use WP_Query (for more info read “When should you use WP_Query vs query_posts() vs get_posts()?“), try this way: $args = array( ‘post_type’ => ‘soiree’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘orderby’ => ‘date_de_concert’, // you don’t need ‘meta_key’ => ‘date_de_concert’ when using meta_query //’meta_key’ => ‘date_de_concert’, ‘order’ => ‘DESC’, ‘meta_query’ => array( … Read more

How do you query wordpress posts using a math formula between multiple meta field values?

I think the easiest way would be to create a third meta field for “score” and use the WordPress update_post_meta() function to automatically calculate its value, based on the values of assignment_value and current_grade. Exactly how to do that has been answered well in this response: https://wordpress.stackexchange.com/a/54068/16 Once you have your third “Score” meta field, … Read more

Post the content of a specific “Custom Post Type” post within a post using a shortcode

I would suggest creating a new custom taxonomy for relations between a post and its “tracks” or grouping of track posts if you’d like that way you can easily create a shortcode that will query all the needed tracks at once using a shortcode instead of calling your shortcode over and over and to order … Read more

Query 1 taxonomy term, exclude another

I guess its because you are trying two conditions on one taxonomy, you can allways create a custom sql query, something like this: $querystr = ” SELECT * FROM $wpdb->posts LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) LEFT JOIN $wpdb->terms ON($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id) WHERE $wpdb->posts.post_type=”resource” AND $wpdb->posts.post_status=”publish” AND $wpdb->term_taxonomy.taxonomy = … Read more

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