Add excerpt to fixed recents posts feature homepage – fix alignment
-
Here is my homepage:
The box right below the slider is called Recent Posts. I can change the category it pulls from, and how many it shows in the back office options.
Here is the css for that particular function:
/* Recent Posts Box */ .recent-box{clear:both;} .recent-box .cat-box-content{ padding:20px; position:relative; } .recent-box .recent-item{ float:left; width:195px; margin:0 10px 10px 0; padding:2px; height:190px; } .recent-box .recent-item:nth-child(3n+3){margin-right:0;} .divider{ background: url(images/stripe.png); height: 10px; overflow: hidden; margin: 10px 0 20px; clear:both; }
For the function in .php, here is the code:
<?php function get_home_recent( $cat_data ){ $exclude = $cat_data['exclude']; $Posts = $cat_data['number']; $Box_Title = $cat_data['title']; $cat_query = new WP_Query(array ( 'posts_per_page' => $Posts , 'category__not_in' => $exclude)); ?> <section class="cat-box recent-box"> <div class="cat-box-title"> <h2><?php echo $Box_Title ; ?></h2> <div class="stripe-line"></div> </div><!-- post-thumbnail /--> <div class="cat-box-content"> <?php if($cat_query->have_posts()): ?> <?php while ( $cat_query->have_posts() ) : $cat_query->the_post()?> <div class="recent-item"> <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?> <div class="post-thumbnail"> <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"> <?php tie_thumb('', 272 ,125); ?> <span class="overlay-icon"></span> </a> </div><!-- post-thumbnail /--> <?php endif; ?> <h3><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h3> <p class="post-meta"> <?php the_time('j F, Y') ?> </p> </div> <?php endwhile;?> <div class="clear"></div> <?php endif; ?> </div><!-- .cat-box-content /--> </section> <div class="clear"></div> <?php } ?>
I have inserted the <?php the_excerpt(); ?> code into the php file for the Recent Box function, but when I do it doesn’t align the boxes below the excerpt, the excerpt just goes behind the pictures below it. The thumbnails are basically fixed and won’t move depending on how much excerpt there is.
Anyone who can maybe help me code this better to get it right?
I would like to get it like this: https://www.infobarrel.com
Where the thumbs below are always aligned left to right going down.
Thanks!
[please do not bump – if it is urgent, consider to hire somebody]
- The topic ‘Add excerpt to fixed recents posts feature homepage – fix alignment’ is closed to new replies.