Modify loop but keep the original query, what am I doing wrong?

You can’t concatenate an array onto query_string like that. See Digging Into WordPress’s post about looping for the right format. Alternately, you can use array_merge() like on the query_posts Codex page. Consider using wp_reset_query() after your loop. Sometimes you’ll also see people save the original $query_string to a new variable, modify $query_string, and then reset … Read more

how to replace get_template_part(‘loop’,’tag’) with explicit styled version?

I think you misunderstand the purpose of get_template_part(). It is a wrapper for locate_template(), which itself is just a wrapper for include(). By calling get_template_part( ‘loop’, ‘tag’ ), you are telling WordPress to look for/include a file based on the following priority: Child Theme loop-tag.php Parent Theme loop-tag.php Child Theme loop.php Parent Theme loop.php If … Read more

How to only publish posts with image in it

I found and modified a chunk of code found here: http://www.wprecipes.com/wordpress-tip-detect-if-a-post-has-at-least-one-image. <?php while ( have_posts() ) : the_post(); $content = $post->post_content; $searchimages=”~<img [^>]* />~”; preg_match_all( $searchimages, $content, $pics ); $iNumberOfPics = count($pics[0]); if ( $iNumberOfPics > 0 ) { //your loop content goes here } endwhile; ?> I think this just looks for images entered … Read more

category__not_in and id values from variable

get_category_by_slug() returns a category object or FALSE: $cat1 = get_category_by_slug( ‘cata’ ); print ‘<pre>’ . htmlspecialchars( print_r( $cat1, TRUE ) ) . ‘</pre>’; Result: stdClass Object ( [term_id] => 3 [name] => Cat A [slug] => cata [term_group] => 0 [term_taxonomy_id] => 3 [taxonomy] => category category__not_in and id values from variable => [parent] => … Read more

How do I get my loop.php to properly paginate?

I don’t know what’s inside featured-content-slider.php, but I’m assuming this is the loop you’d like to paginate: query_posts(‘category_name=featured-news’); The issue is that by calling query_posts like this in the template, you’re overwriting the original query for the page and not setting any page parameter. Your two options are to either modify the original query string, … Read more