Created
March 15, 2012 16:35
-
-
Save farinspace/2045167 to your computer and use it in GitHub Desktop.
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"> | |
<h4>Links</h4> | |
<a href="#" class="dodelete-links button">Remove All Links</a> | |
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras orci lorem, bibendum in pharetra ac, luctus ut mauris.</p> | |
<?php while($mb->have_fields_and_multi('links')): ?> | |
<?php $mb->the_group_open(); ?> | |
<a href="#" class="dodelete button">Remove Link</a> | |
<?php $mb->the_field('title'); ?> | |
<input type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>"/> | |
<?php $mb->the_field('url'); ?> | |
<input type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>"/> | |
<?php $mb->the_group_close(); ?> | |
<?php endwhile; ?> | |
<p><a href="#" class="docopy-links button">Add Link</a></p> | |
</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
<?php | |
$custom_mb = new WPAlchemy_MetaBox(array | |
( | |
'id' => '_custom_meta', | |
'title' => 'My Custom Meta', | |
'template' => get_stylesheet_directory() . '/custom/meta.php' | |
)); | |
/* eof */ |
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 $custom_mb; | |
$custom_mb->the_meta(); | |
if ($custom_mb->have_value('links')) { ?> | |
<ul> | |
<?php while($custom_mb->have_fields('links')) { ?> | |
<?php if ($custom_mb->have_value('url') && $custom_mb->have_value('title')) { ?> | |
<li><a href="<?php $custom_mb->the_value('url'); ?>"><?php $custom_mb->the_value('title'); ?></a></li> | |
<?php } ?> | |
<?php } ?> | |
</ul> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment