Created
July 31, 2011 00:10
-
-
Save anonymous/1116170 to your computer and use it in GitHub Desktop.
WPAlchemy - Issue getting value pulled into page template
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 | |
// add Gallery Images custom meta box | |
$mgallery = new WPAlchemy_MetaBox(array | |
( | |
'id' => '_gallery_main', | |
'title' => 'Gallery Images', | |
'types' => array('gallery_main'), // added only for pages | |
'context' => 'normal', // same as above, defaults to "normal" | |
'priority' => 'high', // same as above, defaults to "high" | |
'template' => TEMPLATEPATH . '/custom/gallery_images_repeatingfields.php', | |
'hide_editor' => TRUE | |
)); | |
?> |
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 $loop = new WP_Query( array( 'post_type' => 'gallery_main', 'posts_per_page' => -1 ) ); | |
while ( $loop->have_posts() ) : $loop->the_post(); ?> | |
<div class="mgallery"> | |
<?php | |
global $mgallery; | |
$mgallery->the_meta(); | |
?> | |
<img src="<?php $mgallery->the_value('imgurl'); ?>" /> | |
</div><!-- end mgallery --> | |
<?php endwhile; ?> |
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 $wpalchemy_media_access; ?> | |
<div class="my_meta_control"> | |
<p><a href="#" class="dodelete-docs button">Remove All</a></p> | |
<?php while($mb->have_fields_and_multi('gallery_image')): ?> | |
<?php $mb->the_group_open(); ?> | |
<a href="#" class="dodelete button">Remove</a> | |
<?php $mb->the_field('imgurl'); ?> | |
<?php $wpalchemy_media_access->setGroupName('n' . $mb->get_the_index())->setInsertButtonLabel('Insert Image')->setTab('type'); ?><!-- label of insert button in media uploader box --> | |
<p> | |
<?php echo $wpalchemy_media_access->getField(array('name' => $mb->get_the_name(), 'value' => $mb->get_the_value())); ?> | |
<?php echo $wpalchemy_media_access->getButton(array('label' => 'Add Image to Gallery')); ?> | |
</p> | |
<?php $mb->the_field('title');?> | |
<label for="<?php $mb->the_name(); ?>">Title</label> | |
<p><input type="text" id="<?php $mb->the_name(); ?>" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>"/></p> | |
<?php $mb->the_field('gname');?> | |
<label for="<?php $mb->the_name(); ?>">Gallery Name</label> | |
<p><input type="text" id="<?php $mb->the_name(); ?>" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>"/></p> | |
<?php $mb->the_group_close(); ?> | |
<?php endwhile; ?> | |
<p style="margin-bottom:15px; padding-top:5px;"><a href="#" class="docopy-docs button">Add</a></p> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment