Post content being duplicated by the_content();

The problem is still present, but I’ve found a workaround for now. When I replaced echo apply_filters(‘the_content’, get_post_field(‘post_content’, $post_id)) with echo wpautop( get_the_content() ), it worked. I also stopped using the variable $post since I wasn’t accessing the global post variable. So that makes my code look like so: $state_posts = array(); while ($query->have_posts()) { … Read more

Total Count of Posts NOT in Selected Categories?

Do your posts have multiple categories? If not – I think individual category counts are cached, so can sum up counts: $categories = get_categories( array( ‘exclude’ => $folio_cat_ids ) ); $count = 0; foreach ( $categories as $category) $count += $category->category_count; Can also just get and count the posts, that is more flexible and takes … Read more

Loop with break in the middle

Try using a loopcounter based on the post number count – provides for more flexibility <?php if (have_posts()) : ?> <?php $count = 0; ?> <?php while (have_posts()) : the_post(); ?> <?php $count++; ?> // if you are in your first post <?php if ($count == 1) : ?> // do whatever you want to … Read more