-
-
Save anonymous/ae30e837cfb4aa17f879 to your computer and use it in GitHub Desktop.
WPAlchemy - Adding post thumbnail
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 $mgallery; ?> | |
<?php $loop = new WP_Query( array( 'post_type' => 'gallery_main', 'posts_per_page' => -1 ) ); ?> | |
<?php while ($loop->have_posts()) { ?> | |
<?php $loop->the_post(); $mgallery->the_meta($post->ID); ?> | |
<div class="mgallery"> | |
<?php $gallery_images = $mgallery->get_the_value('gallery_image'); ?> | |
<?php $i = 0; foreach ($gallery_images as $v) { ?> | |
<a rel="shadowbox[<?php echo $v['gname']; ?>]" href="<?php echo $v['imgurl']; ?>" title="<?php echo $v['title']; ?>"><img class="gimage<?php echo (!$i) ? ' first' : '' ; ?>" src="<?php echo get_the_post_thumbnail($post->ID, 'thumbnail'); ?>" alt="<?php echo $v['title']; ?>"/></a> | |
<?php $i++; } ?> | |
</div><!-- end mgallery --> | |
<?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
<?php global $wpalchemy_media_access; ?> | |
<div class="my_meta_control"> | |
<p><a href="#" class="dodelete-gallery_image 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())->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 get_the_post_thumbnail($post->ID); ?> | |
<?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-gallery_image button">Add</a></p> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment