Loops running into each other
Pretty simple fix, from what I can tell.. after each “loop” you need to reset your term list.. $term_list=””;
Pretty simple fix, from what I can tell.. after each “loop” you need to reset your term list.. $term_list=””;
args = array( ‘post_type’ => ‘product’, ‘meta_query’ => array( array( ‘key’ => ‘brand’, ‘value’ => ‘crocs’, ‘compare’ => ‘LIKE’ ) ) ); $query = new WP_Query( $args ); http://codex.wordpress.org/Class_Reference/WP_Query
The file you included in your question is a custom page template, and would never be used by WordPress to render the single-post view of a blog post. If you don’t have a single.php, then the template hierarchy will fall back to index.php to render the single-post view for blog posts. Edit From your comment … Read more
Ahhh.. not sure why I didn’t think to use tax_query. A friend figured it out. Gist is updated.
I was able to find a solution to my own problem. For anyone needing to solve this in the future, WordPress offers a set of conditional statements for just able everything, include pagination. <?php get_header(); ?> <?php if ( ! $paged || $paged < 2 ){ ?> <?php locate_template( ‘featured-post.php’, true, false ); ?> <?php … Read more
You’ll want ‘orderby’ => ‘meta_value’ to sort by the specified meta_key or ‘orderby’ => ‘meta_value_num’ if it’s a numeric value.
I believe the query var that you are retrieving should be paged and not page. See the codex and adjust your query to the following: $products_query = new WP_Query(array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 4, ‘paged’ => (get_query_var(‘paged’) ? get_query_var(‘paged’) : 1), )); However, if this is an archive for your product post type why … Read more
This is how i got it working: ‘titleFormat’ : function(title, currentArray, currentIndex, currentOpts) { return ‘<span id=”fancybox-title-over”>’ + jQuery(currentArray[currentIndex]).html() + ‘</span>’; }
You don’t need a second loop. Just save all the data you need later during the first loop. Sample code, not tested, just a hint: <ul class=”ei-slider-large”> <?php // Here we store the data. $second_loop = array(); // Main loop $main_query = new WP_Query( array( ‘category_name’ => ‘featured’, ‘posts_per_page’ => 3 ) ); if( $main_query->have_posts() … Read more
This loop looks pretty sure to me. You aren’t exposing any raw SQL anywhere, so injection attacks shouldn’t happen.