Example #1
0
function mpp_gallery_shortcode($atts = null, $content = '')
{
    //allow everything that can be done to be passed via this shortcode
    $defaults = array('type' => false, 'id' => false, 'in' => false, 'exclude' => false, 'slug' => false, 'status' => false, 'component' => false, 'component_id' => false, 'per_page' => false, 'offset' => false, 'page' => false, 'nopaging' => false, 'order' => 'DESC', 'orderby' => 'date', 'user_id' => false, 'include_users' => false, 'exclude_users' => false, 'user_name' => false, 'scope' => false, 'search_terms' => '', 'year' => false, 'month' => false, 'week' => '', 'day' => '', 'hour' => '', 'minute' => '', 'second' => '', 'yearmonth' => false, 'meta_key' => '', 'meta_value' => '', 'fields' => false, 'column' => 4);
    $atts = shortcode_atts($defaults, $atts);
    if (!$atts['meta_key']) {
        unset($atts['meta_key']);
        unset($atts['meta_value']);
    }
    $shortcode_column = $atts['column'];
    mpp_shortcode_save_gallery_data('column', $shortcode_column);
    unset($atts['column']);
    $query = new MPP_Gallery_Query($atts);
    ob_start();
    echo '<div class="mpp-container mpp-shortcode-wrapper mpp-shortcode-gallery-wrapper"><div class="mpp-g mpp-item-list mpp-gallery-list mpp-shortcode-item-list mpp-shortcode-gallery-list"> ';
    while ($query->have_galleries()) {
        $query->the_gallery();
        mpp_get_template_part('shortcodes/gallery', 'entry');
        //shortcodes/gallery-entry.php
    }
    mpp_reset_gallery_data();
    echo '</div></div>';
    $content = ob_get_clean();
    mpp_shortcode_reset_gallery_data('column');
    return $content;
}
/**
 * List galleries drop down
 * 
 * @param type $args
 * @return string
 */
function mpp_list_galleries_dropdown($args = null)
{
    $default = array('name' => 'mpp-gallery-list', 'id' => 'mpp-gallery-list', 'selected' => 0, 'type' => '', 'status' => '', 'component' => '', 'component_id' => '', 'posts_per_page' => -1, 'echo' => 1, 'label_empty' => '');
    $args = wp_parse_args($args, $default);
    extract($args);
    if (!$component || !$component_id) {
        return;
    }
    $mppq = new MPP_Gallery_Query($args);
    $html = '';
    $selected_attr = '';
    if ($label_empty) {
        $html .= "<option value='0'" . selected(0, $selected, false) . ">" . $label_empty . "</option>";
    }
    while ($mppq->have_galleries()) {
        $mppq->the_gallery();
        $selected_attr = selected($selected, mpp_get_gallery_id(), false);
        $html .= "<option value='" . mpp_get_gallery_id() . "'" . $selected_attr . " data-mpp-type='" . mpp_get_gallery_type() . "'>" . mpp_get_gallery_title() . "</option>";
    }
    //reset current gallery
    mpp_reset_gallery_data();
    if (!empty($html)) {
        $html = "<select name='{$name}' id='{$id}'>" . $html . "</select>";
    }
    if (!$echo) {
        return $html;
    } else {
        echo $html;
    }
}
Example #3
0
				
				<div class="mpp-item-meta mpp-gallery-meta mpp-gallery-meta-bottom">
						<?php 
        do_action('mpp_gallery_meta');
        ?>
				</div>
				
				<?php 
        do_action('mpp_after_gallery_entry');
        ?>
			</div>

		<?php 
    }
    ?>
	</div>
<?php 
    mpp_reset_gallery_data();
    ?>
 
<?php 
} else {
    ?>
	<div class="mpp-notice mpp-no-gallery-notice">
		<p> <?php 
    _ex('There are no galleries available!', 'No Gallery Message', 'mediapress');
    ?>
 
	</div>
<?php 
}