Solved

display output in two columns on page

Posted on 2011-09-22
3
281 Views
Last Modified: 2012-05-12
I have the following php code that displays all my members in a single column down the page.  Is it possible to place those members into two columns on the page?

<?php
foreach (get_users ("role=s2member_level1") as $user)
{
$user = new WP_User ($user->ID);
echo "\n" . do_shortcode("[show_avatar id=$user->ID avatar_size=120]", $user->ID) . "\n" . "<strong>Name:</strong> " . get_user_field ("display_name", $user->ID) . "\n" . "<strong>Age:</strong> " . get_user_field ("age", $user->ID) . "\n" . "<strong>About Me:</strong> " . get_user_field ("about_me", $user->ID) . "\n";
}
?>
0
Comment
Question by:COwebmaster
3 Comments
 
LVL 16

Expert Comment

by:rbudj
ID: 36581921
0
 
LVL 15

Accepted Solution

by:
ncoo earned 500 total points
ID: 36581935
You could do something like this:
<table>
<?php
$i = 0;
foreach (get_users ("role=s2member_level1") as $user)
{
	$user = new WP_User ($user->ID);
	if ($i%2 == 0) {
		echo '<tr>';
	}

	echo '<td>';

	echo "\n" . do_shortcode("[show_avatar id=$user->ID avatar_size=120]", $user->ID) . "\n" . "<strong>Name:</strong> " . get_user_field ("display_name", $user->ID) . "\n" . "<strong>Age:</strong> " . get_user_field ("age", $user->ID) . "\n" . 
	"<strong>About Me:</strong> " . get_user_field ("about_me", $user->ID) . "\n";

	echo '</td>';

	if ($i%2 != 0) {
		echo '</tr>';
	}
	$i++;
}
?>
</table>

Open in new window

0
 

Author Closing Comment

by:COwebmaster
ID: 36582068
Perfect! Thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
The viewer will learn how to dynamically set the form action using jQuery.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now