Does wp_query and query_posts affect website performance? [duplicate]
The question was answered a few times on this site. Have a look at this answer
The question was answered a few times on this site. Have a look at this answer
I just use ‘nopaging’ => true and it solves my problem.
You’ll have to get the terms of current post with get_the_terms function and then use them in your query. // this will get terms and then get only term_ids from them $term_ids = wp_list_pluck( get_the_terms( get_the_ID(), ‘coupon_category’ ), ‘term_id’ ); $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $related = new WP_Query( array( ‘post_type’ => APP_POST_TYPE, … Read more
If you have your data in separate table adding support for it in query is somewhat messy. Basically you will need to filter posts_where and posts_join to modify raw SQL query so that your custom table is joined and checked against your custom values. As per [faster :)] anu’s suggestion it would make sense to … Read more
If you are only showing one post of each category then in your query_posts() change the &paged=’.$paged to &offset=”.$paged
I think you can do a left join : left join $wpdb->postmeta my_field_meta on (p.ID = my_field_meta.post_id and my_field_meta.meta_key = ‘subscribe’) Where “subscribe” it’s the name of your custom field. So your code could be: $dayswithposts = $wpdb->get_results(“SELECT DISTINCT DAYOFMONTH(p.post_date) FROM $wpdb->posts as p LEFT JOIN $wpdb->postmeta my_field_meta on (p.ID = my_field_meta.post_id and my_field_meta.meta_key = … Read more
your problem is that in the first loop you overwrite $do_not_duplicate for each post in the loop so at the end you only have the id of the last post. if you change $do_not_duplicate into an array then you can add each post to the array: //before the loop $do_not_duplicate = array(); //in the loop … Read more
did you call rewind posts? I’ve done something similar on a site and used css to solve. The site uses 960 grid (960.gs), which comes packaged with “push” and “pull” classes that let you rearrange content relative to its position in the markup. In our case, the sidebar content is coming from a sidebar template … Read more
I just wrote this up so I have not tested it but this is how I would go about forcing one post to be at the end. In the first loop it excludes the posts by its ID number and in the second loop it only includes the post by the ID number, essentially you … Read more
Hah. I forgot <?php the_content(); ?>