Jump to content

Boxes is not appearing right


jownas

Recommended Posts

Hello,

 

I need help with this code. I want all of the 3 divs to be beside etch other. It now appears that the first 2 is beside etch other but the 3d one is on a row under. How to force the last one to be at the same row? etc scale them down or change some code to have them all 3 beside etch others? Ignore the minimum 5 posts to be shown in the code.

i have attatched code and a screenshot on how it looks like.

Thanks,

<?php

$post_data = array();

if ( $posts->have_posts() ) {
	$i = 1;
	while ( $posts->have_posts() ) :
		
		if( $i > 5 ){
			break;	
		}
		
		$posts->the_post();
		global $post;
		$img = king::get_featured_image( $post );
		
		$post_data[] = array(
			'title' => $post->post_title,
			'content' => strip_tags($post->post_content),
			'date' => get_the_date( 'F d, Y', $post->ID ),
			'link' => get_permalink($post->ID),
			'img' => king_createLinkImage( $img, '360x220xc' )
		);
		
		$i += 1;
		endwhile;
	}
	// Posts not found
	else {
		echo '<h4>' . __( 'Posts not found', 'hoxa' ) . '</h4>';
	}
?>

<?php if($i >= 5): ?>
<div class="one_third">    
	<div class="bnbox two">		
		<img class="img_left" alt="" src="<?php echo esc_attr($post_data[3]['img']); ?>">		
		<div class="bnbox three">		
		<h5><?php echo $post_data[0]['title']; ?></h5>		
		<em><?php echo $post_data[0]['date']; ?></em>		
		<p><?php $words  = array_slice(explode(' ', $post_data[0]['content']), 0, 15);
			$content = implode(' ', $words);
			echo esc_html($content); ?></p>
		<br>
		<a class="readmore_but7" href="<?php echo esc_attr($post_data[0]['link']); ?>">Mer</a>		
		</div>	
	</div><!-- end section -->
</div>
<div class="one_third">    
	<div class="bnbox two">		
		<img class="img_left" alt="" src="<?php echo esc_attr($post_data[3]['img']); ?>">		
		<div class="bnbox three">		
		<h5><?php echo $post_data[2]['title']; ?></h5>		
		<em><?php echo $post_data[2]['date']; ?></em>		
		<p><?php $words  = array_slice(explode(' ', $post_data[2]['content']), 0, 15);
			$content = implode(' ', $words);
			echo esc_html($content); ?></p>
		<br>
		<a class="readmore_but7" href="<?php echo esc_attr($post_data[2]['link']); ?>">Mer</a>		
		</div>	
	</div><!-- end section -->
</div>
<div class="one_third">    
	<div class="bnbox two">		
		<img class="img_left" alt="" src="<?php echo esc_attr($post_data[3]['img']); ?>">		
		<div class="bnbox three">		
		<h5><?php echo $post_data[3]['title']; ?></h5>		
		<em><?php echo $post_data[3]['date']; ?></em>		
		<p><?php $words  = array_slice(explode(' ', $post_data[3]['content']), 0, 15);
			$content = implode(' ', $words);
			echo esc_html($content); ?></p>
		<br>
		<a class="readmore_but7" href="<?php echo esc_attr($post_data[3]['link']); ?>">Mer</a>		
		</div>	
	</div><!-- end section -->
</div>

	
		<?php else: ?>
<p><?php echo 'This layout only support list larger than 5 posts'; ?></p>
<?php endif; ?>

post-204165-0-67901700-1493033103_thumb.png

Link to comment
Share on other sites

Your page will flow like that when things don't fit. Adjust your widths so that they fit.. Of course if you are trying to put too much on the page, you may have to rethink your design.

 

Your code is not very helpful since we know nothing about the class you are using.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.