WordPress.org

Ready to get started?Download WordPress

Forums

Add excerpt to fixed recents posts feature homepage - fix alignment (4 posts)

  1. bmeredith84
    Member
    Posted 1 year ago #

    Here is my homepage:

    http://www.tendig.com

    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: http://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]

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    Stop bumping!

  3. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    impossible to make any suggestions:

    your problem is not present in your site - there are no excerpts in the html code of that linked site (viewed in the browser).

    if there were excerpts, and they are covered by the thumbnails, check the css for 'absolute' positioning.

    using a tool such as Firebug http://getfirebug.com/ might help to find the involved styles.

  4. bmeredith84
    Member
    Posted 1 year ago #

    Yes I haven't added the excerpt because when I do it looks horrible. Where do I need to look for absolute positioning and what do I need to change it to?

Topic Closed

This topic has been closed to new replies.

About this Topic