Created
January 19, 2012 19:51
-
-
Save kirstenkeister/1642159 to your computer and use it in GitHub Desktop.
WPAlchemy meta definitions for repeating links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $peoplelinks_mb; | |
$peoplelinks_mb->the_meta(); | |
if ($peoplelinks_mb->have_fields('links')) { ?> | |
<div id="info-links" class="column left"> | |
<h2 class="column-title">Links</h2> | |
<ul> | |
<?php // loop a set of field groups | |
while($peoplelinks_mb->have_fields('links')) { | |
$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>'; | |
} ?> | |
</ul> | |
</div> | |
<?php } ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="my_meta_control"> | |
<div class="remove-all-button"><a href="#" class="dodelete-links button remove-all">Remove All</a></div> | |
<p>Add links by entering in a title in the first field and the URL in the second. Add a new link by clicking the "Add Link" button.</p> | |
<?php while($mb->have_fields_and_multi('links')): ?> | |
<?php $mb->the_group_open(); ?> | |
<?php $mb->the_field('title'); ?> | |
<p><input type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>"/></p> | |
<?php $mb->the_field('url'); ?> | |
<p><input type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>"/></p> | |
<div class="remove-button"><a href="#" class="dodelete button remove">Remove Link</a></div> | |
<br clear="all" /> | |
<?php $mb->the_group_close(); ?> | |
<?php endwhile; ?> | |
<div class="add-another-link"><a href="#" class="docopy-links button add-another">Add Link</a></div> | |
<br clear="all" /> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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' | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment