Looking for a more efficient way to code this page…
-
I have created the visual effect and content that I want displayed on the site https://blissfullydomestic.com but the page ends up with 186 queries I need to try to find a more efficient way to accomplish this layout.
I have 15 top level categories. I need to display them in a grid with 3 columns and 5 rows displaying the following:
- category image linking to the category archive
- Rss image linking to category feed
- last 5 post titles linking to posts
Here is one column of code from the index.php file
<div id="leftcol"> <?php // enter the IDs of which categories you want to display $display_categories = array(22,31,76,32,88); foreach ($display_categories as $category) { ?> <div class="clearfloat"> <?php query_posts("showposts=5&cat=$category"); $wp_query->is_category = false; $wp_query->is_archive = false; $wp_query->is_home = true; ?> <?php $getcategory = $wp_query->get_queried_object(); $getcategory->category_nicename; ?> <div class="category-icon"> <a href="<?php echo get_category_link($category);?>"> <img src="https://blissfullydomestic.com/wp-content/images/icons2/<?php echo $category ?>.png"> </a></div> <div class="rss-icon"><a href="<?php echo get_category_link($category);?>feed "><img src="https://blissfullydomestic.com/wp-content/themes/blissfullydomestic/images/rss.png"></a> </div> <br style="clear:both"/> <div class="editor"><?php echo category_description($category); ?></div> <br style="clear:both"/> <div class="recent-posts"><ul> <?php while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink() ?>" rel="bookmark" class="title" title="Permanent Link to <?php the_title(); ?>"><?php the_title2('', '...', true, '40') ?></a></li> <?php endwhile; ?></ul></div> </div> <?php } ?> </div> <!--END LEFTCOL-->
I appreciate all suggestions and feedback!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Looking for a more efficient way to code this page…’ is closed to new replies.