Adding multiple meta_key fields as orderby options to a WP Query via a function
Adding multiple meta_key fields as orderby options to a WP Query via a function
Adding multiple meta_key fields as orderby options to a WP Query via a function
The reason you’re getting a white screen is you never defined “$string”. You only concatenated it. In the future you can find your errors when creating functions by turning wp_debug to true in your wp_config.php file. Here is code that should work: function new_function() { //Arguments: posts, in classifieds category, that are published, and from … Read more
Let’s say that wp-load is in the folder /myproject/ of your /myproject/wp-content/themes/fount/myfolder/ tree. From /myfolder/ you would access it with “../../../../wp-load.php”.
One of the function call was written in the global scope, and firing before all the scripts could be properly loaded. Moving the function call out of the global space, the error went away. Functions that require or use WordPress functions should not be called before WordPress has successfully loaded it’s scripts.
Try this: ` $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; $genral_args = array( ‘posts_per_page’ => ’50’, ‘post_type’ => ‘documents’, ‘cat’ => ‘your-category-id’, ‘paged’ => $paged ); $genral_query = new WP_Query( $genral_args ); while ( $genral_query->have_posts() ) : $genral_query->the_post(); ?> <?php //If we have the posts… if (the_field (‘title’)) : … Read more
How to implement a new row_count method in WordPress?
Query posts without meta preload
As @milo said in the comments, the cat parameter (and similar parameters in other hierarchical taxonomies) will make the query look in subcategories as well. If you do not want that to happen use the category__in parameter. As for the general slowness, it is hard to guess, but it depends on your DB server performance … Read more
posts_per_page not working for first page of pagination
OK, so this code looks really bad, but let’s try to clean it a little bit and make it work… First of all, there is no need to all that mess with cloning queries. It makes no sense, to be honest. wp_reset_query() will recreate all query based on request, so there is no point in … Read more