/** * Handle redirects before content is output - hooked into template_redirect so is_page albums. * * @access public * @return void */ function wolf_albums_template_redirect() { if (is_page(wolf_albums_get_page_id())) { wolf_albums_get_template('albums-template.php'); exit; } }
/** * Output the end of a ticket loop. By default this is a UL * * @access public * @return void */ function wolf_albums_loop_end($echo = true) { ob_start(); wolf_albums_get_template('loop/loop-end.php'); if ($echo) { echo ob_get_clean(); } else { return ob_get_clean(); } }
while (have_posts()) { the_post(); ?> <?php wolf_albums_get_template_part('content', 'album'); ?> <?php } ?> <?php wolf_albums_loop_end(); ?> <?php } else { ?> <?php wolf_albums_get_template('loop/no-album-found.php'); ?> <?php } // end have_posts() check ?> </div><!-- .albums-container --> <?php get_footer('albums');
/** * Shortcode * * @param array $atts * @return string */ function shortcode($atts) { extract(shortcode_atts(array('count' => 3, 'category' => null, 'col' => $this->get_option('col', 3)), $atts)); ob_start(); $args = array('post_type' => array('gallery'), 'posts_per_page' => absint($count)); if ($category) { $args['gallery_type'] = $category; } $loop = new WP_Query($args); if ($loop->have_posts()) { ?> <div class="shortcode-gallery-grid gallery-grid-col-<?php echo intval($col); ?> "> <?php while ($loop->have_posts()) { $loop->the_post(); ?> <?php wolf_albums_get_template_part('content', 'album'); ?> <?php } ?> </div><!-- .shortcode-albums-grid --> <?php } else { // no album ?> <?php wolf_albums_get_template('loop/no-album-found.php'); ?> <?php } wp_reset_postdata(); $html = ob_get_contents(); ob_end_clean(); return $html; }