Having trouble with WooCommerce Storefront child theme single.php “related posts” modification [closed]

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

WP Query with categories only shows one post and ignores the category

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

Slow queries on a huge database

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