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; }
function mpp_shortcode_list_gallery($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']); //unset( $atts['view'] ); $query = new MPP_Gallery_Query($atts); mpp_shortcode_save_gallery_data('gallery_list_query', $query); ob_start(); //include temlate mpp_get_template('shortcodes/gallery-list.php'); $content = ob_get_clean(); mpp_shortcode_reset_gallery_data('column'); mpp_shortcode_reset_gallery_data('gallery_list_query'); return $content; }