Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php function getGallery($galleryLink, $altLink){
- global $post;
- // 1. search for any pages with a custom field of 'test' that have a value of 'yes'
- query_posts('meta_key='.$galleryLink.'&post_type=page');
- if ( have_posts() ) while ( have_posts() ) : the_post();
- // 2. echo the test field
- $link = get_post_meta($post->ID, $galleryLink, true);
- $alt = get_post_meta($post->ID, $altLink, true); ?>
- <img src="<?php echo $link ?>" alt="<?php echo $alt ?>" />
- <?php endwhile;
- wp_reset_query();
- }?>
- <?php getGallery('Gallery - Promotion Gallery Photo Link', 'Gallery - Promotion Gallery Photo Alt text'); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement