Disable (or limit) queries when certain content (or data) is not needed (or showed)

You can filter ‘posts_fields’, check if it is the main query and limit the queried fields to … whatever you need. See WP_Query::get_posts() in /wp-includes/query.php for details and side effects. For debugging the queries I recommend the plugin Debug Bar. If you add … define( ‘WP_DEBUG’, TRUE ); define( ‘SAVEQUERIES’, TRUE ); … to your … Read more

How go give $value to wp_query

Assuming removeCommonWords() returns a string, you can do the following: $zoekterm = removeCommonWords(‘motorkap met’); $query2 = new WP_Query( array( ‘s’ => $zoekterm ) ); while( $query2->have_posts() ) { $query2->the_post(); echo the_title() . ‘</br> ‘; } Sometimes the array notating is more useful than the string notation …

Adding pagination to sub-wp_query within a singular post page

You need to add a query var and rewrite rule to make that work. First, add the query var to WordPress query vars array in your theme’s functions.php: add_filter( ‘query_vars’, ‘wpa58904_query_vars’ ); function wpa58904_query_vars( $query_vars ){ $query_vars[] = ‘my_page’; return $query_vars; } Then add a rewrite rule with your desired pattern that sets your custom … Read more

Attempt to display site authors in a carousel – User Image not Outputting inside li tags

You should be using get_users() – this will perform your query and also allow you to limit by role. http://codex.wordpress.org/Function_Reference/get_users userphoto isn’t a WordPress function, but get_avatar() is: http://codex.wordpress.org/Function_Reference/get_avatar Just check out the Codex examples and you should be able to modify to suit your needs! — UPDATE — I reread and realized maybe userphoto … Read more

Featured images loop for Orbit Slider

I’d use the this code to print the image instead of using the_post_thumbnail();. So that the $slider_query->current_post can be used to print the current iteration of post in WP_Query loop. Eg. <img src=”https://wordpress.stackexchange.com/questions/61017/<?php wp_get_attachment_url( get_post_thumbnail_id() ); ?>” alt=”the-alt-tag” data-caption=”#htmlCaption-<?php $slider_query->current_post; ?>” /> Update – Untested but it should work. Make sure you turn on WordPress … Read more