show posts under subcategory only when in that subcategory

If you use the follow code: <?php $cats = get_categories(‘child_of=6’); foreach ($cats as $cat) : $this_category = get_category($cat); $args = array( ‘category__in’ => array($cat->term_id) ); $my_query = new WP_Query($args); if ($my_query->have_posts()) : ?> <li><a href=”https://wordpress.stackexchange.com/questions/41725/<?php echo get_category_link($cat); ?>”><?php echo $cat->name; ?></a> <?php if ($this_category->category_parent != 0) { ?> <ul class=”children”> <?php while ($my_query->have_posts()) : $my_query->the_post(); … Read more

Single post page breaks when post is more than 30,000 words

There isn’t a text limit within WordPress itself, but you may be bumping into memory limits at your webhost. Using FTP you can try increasing the memory for PHP and WordPress several different ways: 1) You can edit the memory_limit line in your php.ini (if you have access to that file) to 64M: memory_limit = … Read more

Query posts and filter at query time by value of custom meta

This is super easy to do with meta_querys: $args = array( //basics ‘post_type’ => ‘prizes’, // from question ‘post_status’ => ‘publish’, // you didn’t have this, but it’s good practice ‘posts_per_page’ => 3, // I don’t know where you got ‘showposts’, but that’s WAY old //order ‘orderby’ => ‘rand’, //meta query ‘meta_query’ => array( array( … Read more

Why won’t pagination work?

probably coz you override the default query and forgot to take care of pagination 🙂 change the code this way: $page = isset(get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args = array( ‘numberposts’ => $numposts, ‘paged’ => $paged ); This should do the work