Relative number of post in category

Are you using the main query or a custom WP_Query for displaying the posts? If so : $wp_query->found_posts; //Main query $wp_query->current_post; // current post index or $my_wp_query->found_posts; //custom wp_query object – total found posts $my_wp_query->current_post; // current post index So, example if( have_posts() ) : while( have_posts() ) : the_post(); ?> <p>The post <?php the_title(); … Read more

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