WordPress.org

Ready to get started?Download WordPress

Forums

List pages in two columns (3 posts)

  1. imcobarn
    Member
    Posted 3 years ago #

    Hi,

    I'm using the code below to display a list of pages in two column, with specific meta key.
    Works fine but when I repeat the code to display second set of pages with different meta key (custom field) it includes pages from first loop as well.
    I need to run several sets of page lists with different meta keys.
    How can I fix this?

    Thanks.

    Here is the code:

    <?php
    $page_s = explode("</li>",wp_list_pages('title_li=&meta_key=series&meta_value=three&echo=0&depth=1&style=none'));
    $page_n = count($page_s) - 1;
    $page_col = round($page_n / 2);
    for ($i=0;$i<$page_n;$i++){
     if ($i<$page_col){
      $page_left = $page_left.''.$page_s[$i]."</li>";
     }
     elseif ($i>=$page_col){
      $page_right = $page_right.''.$page_s[$i]."</li>";
     }
    }
    ?>
    <center>
    <h3>3 Series</h3>
    <ul id="twocol_list_left">
    <?php echo $page_left; ?>
    </ul>
    <ul id="twocol_list_right">
    <?php echo $page_right; ?>
    </ul>
    
    </center>
  2. imcobarn
    Member
    Posted 3 years ago #

    Anyone knows how to?
    Thanks.

  3. imcobarn
    Member
    Posted 3 years ago #

    I think I got it.

Topic Closed

This topic has been closed to new replies.

About this Topic