Jump to content
php.lv forumi

Foreach ul srakstā horizontālu bildi novieto pa vidu

Recommended Posts

Sveiki! Kā būtu iespējams šo UL izkārtojumu iestutēt forech cilpā?

<ul class="rec-album-list">
	foreach($recs as $rec){
		$table_images = $wpdb->prefix.'album_images';
		$img = $wpdb->get_row("SELECT * FROM $table_images WHERE aid='".$rec->id."' AND imgid='".$rec->front_image."'");
		if($img->orientation == 'vertical'){
			$ver_image[] = wp_get_attachment_image($img->imgid, 'medium_large', '', ['class' => '']);
		}else if($img->orientation == 'horizontal'){
			$hor_image[] = wp_get_attachment_image($img->imgid, 'medium_large', '', ['class' => '']);
		<li class="rec-album rec-album-vertical"><?php echo $ver_image[0]; ?></li>
		<li class="rec-album rec-album-horizontal"><?php echo $hor_image[0]; ?></li>
		<li class="rec-album rec-album-vertical"><?php echo $ver_image[1]; ?></li>


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now