Filtering problem

… I will need to be more specific, by adding a “%” after $author (James). The problem is that this will not work at all. Any idea why? The % is a wildcard with a MySQL LIKE query, which I suspect you know. With meta queries, WordPress will add one to the beginning and one … Read more

Categories and page filtering with pre_get_posts

Please Consider this snippets of code. <?php $myarticles = new WP_Query( ‘post_type=myarticles&orderby=date&order=DESC&cat=4’ ); while ($myarticles->have_posts()) : $myarticles->the_post(); $postTitle = get_the_title(); $postid = get_the_id(); $postContent = get_the_content(); ?> <li><p><?php echo $postTitle; ?></p> <a href=”#”><?php the_post_thumbnail(array(219,143)); ?></a> <p><?php echo $postContent; ?></p> </li> <?php endwhile; ?>

Noob Loop Question

If you want to check the number of posts on each page, you can use the found_posts method of WP_Query : <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $portfolio = new WP_Query(array(‘post_type’ => ‘project’, ‘posts_per_page’ => 12, ‘paged’ => $paged)); if ($portfolio && $portfolio->found_posts >= 2) : while ($portfolio->have_posts()) : $portfolio->the_post(); echo “<div>”; the_title(); … Read more