• Hi,

    I am using Magic Fields to create a menu system for someone and have it working great so far. My problem is that I want to display, say 5, duplicated groups (dishes) in one column and then the other 5 in a 2nd column next to it!?

    I have code working to display everything fine one after another in a single column but don’t know how to edit my loop to split it into 2 columns!? My code is below:


    <div class="menu">
    <?php query_posts('category_name=food&order=ASC'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php $myEvent = get_group('food section'); foreach($myEvent as $event){ ?>
    <div class="section">
    <h3><?php echo $event['name'][1]; ?></h3>
    <div class="price"><?php echo $event['price'][1]; ?></div>
    <div class="price"><?php echo $event['s-price'][1]; ?></div>
    <div class="description"><?php echo $event['description'][1]; ?></div>
    <div class="options"><?php echo $event['options'][1]; ?></div>
    <div class="price"><?php echo $event['o-price'][1]; ?></div>
    </div>
    <?php } ?>
    <?php endwhile; else: ?>
    <p>Error Message</p>
    <?php endif; ?>

    I would really appreciate some help please! I don’t think I will be able to solve this on my own!?

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter andywd7

    (@andywd7)

    <div class="menu">
    	<?php query_posts('category_name=food&order=ASC'); ?>
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    	<?php $myEvent = get_group('food section'); foreach($myEvent as $event){ ?>
    	<div class="section">
    		<h3><?php echo $event['name'][1]; ?></h3>
    		<div class="price"><?php echo $event['price'][1]; ?></div>
    		<div class="price"><?php echo $event['s-price'][1]; ?></div>
    		<div class="description"><?php echo $event['description'][1]; ?></div>
    		<div class="options"><?php echo $event['options'][1]; ?></div>
    		<div class="price"><?php echo $event['o-price'][1]; ?></div>
    	</div>
    	<?php } ?>
    	<?php endwhile; else: ?>
    		<p>Error Message</p>
    	<?php endif; ?>

    something like this

    foreach($myEvent as $k => $event){
      if($k <= 4){
       //code first column
      }else{
       //code second column
     }
    }
    Thread Starter andywd7

    (@andywd7)

    Thank for your help hunk!

    Unfortunately that didn’t work! But I’ve now realised that I’m going to have to do it slightly differently, for design reasons.

    I want to now display the first two posts (not groups) in the left column and the other, say 5, posts in the right column. Any ideas how to get it to do this!? I’ve tried reading about the loop in the codex but am unsure how it works with the loop and MF stuff I already have!?

    Thank you for your help and any future help! I really appreciate it!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Magic fields duplicate groups over 2 columns’ is closed to new replies.