Skip to content

Instantly share code, notes, and snippets.

@jdickie
Forked from kirstenkeister/content-person.php
Created January 31, 2012 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jdickie/1712806 to your computer and use it in GitHub Desktop.
Save jdickie/1712806 to your computer and use it in GitHub Desktop.
WPAlchemy meta definitions for repeating links
<?php
global $peoplelinks_mb;
$peoplelinks_mb->the_meta();
$i = 0;
while($peoplelinks_mb->have_fields('links')) {
?>
<?php
if($i == 0) { ?>
<div id="info-links" class="column left">
<h2 class="column-title">Links</h2>
<ul>
<?php } ?>
<?php // loop a set of field groups
$url = $peoplelinks_mb->get_the_value('url');
$title = $peoplelinks_mb->get_the_value('title');
echo '<li><a href="' . $url . '" target="_blank" rel="nofollow">';
echo $title . '</a></li>';
<?php
$i++;
// End while loop
}
if($i > 0) { ?>
</ul>
</div>
<?php } ?>
$peoplelinks_mb = new WPAlchemy_MetaBox(array(
'id' => '_people_links',
'title' => 'Links',
'types' => array('people'),
'mode' => WPALCHEMY_MODE_EXTRACT,
'template' => get_stylesheet_directory() . '/metaboxes/people-meta-links.php'
));
@kirstenkeister
Copy link

Grant,
it looks like the is_first() and is_last() calls are to be used in the definitions of the metaboxes php file as opposed to this one. So maybe I can add the text there instead. I'll try it... unless you have another idea for how to references the first and last items of the loop.

Kirsten

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment