[email protected]
Forum Replies Created
-
Hey hubspot currently lowers my score by 30 points, is this currently in the works?
Forum: Developing with WordPress
In reply to: Single Query Running Multiple Loops, repeating postsI think my theory was off base, basically, I was trying to figure out how to runway fewer queries. The site I’m working on has hundreds if not thousands of posts and having a query for each style change seemed like it would eventually cause issues.
<?php $args = array( 'posts_per_page' => 7, 'category_name' => 'featured', 'paged'=>$paged); $featured = new WP_Query($args); if ($featured->have_posts()) : $count = 0; $paged = ( get_query_var('paged') > 1 ) ? get_query_var('paged') : 1 ; while ($featured->have_posts()) : $featured->the_post(); $count++; if ($count <= 1 && $paged === 1) : if ($count === 1); ?> <?php get_template_part('front/top'); ?> <?php elseif (1 < $count && $count <= 2 && $paged === 1) : if ($count === 1); ?> <?php get_template_part('front/featured-loop-1'); ?> <?php elseif (2 < $count && $count <= 3 && $paged === 1) : if ($count === 1); ?> <?php get_template_part('front/featured-loop-2'); ?> <?php elseif (3 < $count && $count <= 4 && $paged === 1) : if ($count === 1); ?> <?php get_template_part('front/featured-loop-1'); ?> </section> <div class="col-lg-3 col-sm-12 col-md-12 double featured-post offset-lg-0 offset-0"> <section class="featured-content row bottoms"> <?php elseif (4 < $count && $count <= 8 && $paged === 1) : if ($count === 1); ?> <?php get_template_part('front/featured-loop-3');?> <?php else : if ($count === 9) ?> <br> <?php endif; endwhile; ?> <?php endif; ?> <!---! this should be a side bar of smaller older featured posts !---> </section></div> </section></div> <?php $args = array( 'posts_per_page' => 1, 'category_name' => 'podcast', 'paged'=>$paged); $featured = new WP_Query($args); if ($featured->have_posts()) : $count = 0; $paged = ( get_query_var('paged') > 1 ) ? get_query_var('paged') : 1 ; while ($featured->have_posts()) : $featured->the_post(); $count++; if ($count <= 1 && $paged === 1) : if ($count === 1); ?> <?php get_template_part('front/social'); ?> <?php get_template_part('front/social-loop'); ?> <?php endif; endwhile; ?> <?php endif; ?> <?php wp_reset_query(); ?> <?php get_template_part('front/sidebar-featured-widget'); ?>
This is what I eventually got… which is two queries instead of say 6 different ones.
Thanks for helping me get there, appreciate it! I still need to clean up the code a bit after rethinking my idea, but that’s what I eventually created.
- This reply was modified 4 years, 5 months ago by [email protected].
Forum: Developing with WordPress
In reply to: Single Query Running Multiple Loops, repeating postsso after digging, I think my concept was somewhat off, appreciate the feedback!
Basically, I ended up using this concept to kind of create another concept from here:
https://wordpress.stackexchange.com/questions/225961/how-to-change-post-count-in-wordpress-loopForum: Developing with WordPress
In reply to: Single Query Running Multiple Loops, repeating posts<?php $args = array( 'posts_per_page' => 1); $featured = new WP_Query($args); if ($featured->have_posts()) : while ($featured->have_posts()) : $featured->the_post();?> <?php $do_not_duplicate = $post->ID; ?> <?php get_template_part('front/top'); ?> <?php endwhile; endif; ?> <?php $featured->rewind_posts(); ?> <!---! this should be one post that looks different !---> <?php get_template_part('front/top-stories'); ?> <div class="container"><section class="row front"> <section class="col-lg-9 col-md-12 col-sm-12 featured-post"> <?php while ($featured->have_posts()) : $featured->the_post(); ?> <?php get_template_part('front/featured-loop-1'); ?> <?php endwhile; ?> <?php $featured->rewind_posts(); ?> <!---! this should be one post that looks different !---> <?php while ($featured->have_posts()) : $featured->the_post(); ?> <?php get_template_part('front/featured-loop-2'); ?> <?php endwhile; ?> <?php $featured->rewind_posts(); ?> <!---! this should be one post that looks different !---> <?php while ($featured->have_posts()) : $featured->the_post(); ?> <?php get_template_part('front/featured-loop-1'); ?> <?php endwhile; ?> <?php $featured->rewind_posts(); ?> <!---! this should be one post that looks different !---> </section> <div class="col-lg-3 col-sm-12 col-md-12 double featured-post offset-lg-0 offset-0"> <section class="featured-content row bottoms"> <?php while ($featured->have_posts()) : $featured->the_post(); ?> <?php get_template_part('front/featured-loop-3'); ?> <?php endwhile; ?> <?php wp_reset_query; ?> </section></div> </section></div>
@joyously appreciate the feed back and help!
So, I’ve changed up my code, but it’s essentially doing the same thing and repeating the first post 4 times. Thanks for the help again everyone
Forum: Plugins
In reply to: [WooCommerce] Remove From Cart Button Not Working in Safari@mailmechanic and @madeincosmos yall mind checking if youre seeing the same cache issues?
Forum: Plugins
In reply to: [WooCommerce] Remove From Cart Button Not Working in SafariYeah sadly I am, tho the server person says they disabled all caching, so maybe its something else
Forum: Plugins
In reply to: [WooCommerce] Remove From Cart Button Not Working in SafariUsing Nginx Settings, excluding from caching:
/cart/
/checkout/
/my-account/Forum: Plugins
In reply to: [WooCommerce] Remove From Cart Button Not Working in SafariOkay try now, I just realized I broke something else, sorry.
Forum: Fixing WordPress
In reply to: Post White Screen of DeathYeah—tried this before I made the post—it didn’t work. Do folks have other thoughts on what could cause a JS conflict like this?