Example #1
0
/**
 * Handle redirects before content is output - hooked into template_redirect so is_page works.
 *
 * @access public
 * @return void
 */
function wolf_discography_template_redirect()
{
    if (is_page(wolf_discography_get_page_id())) {
        wolf_discography_get_template('discography-template.php');
        exit;
    }
}
Example #2
0
 /**
  * Output the end of a ticket loop. By default this is a UL
  *
  * @access public
  * @return void
  */
 function wolf_discography_loop_end($echo = true)
 {
     ob_start();
     wolf_discography_get_template('loop/loop-end.php');
     if ($echo) {
         echo ob_get_clean();
     } else {
         return ob_get_clean();
     }
 }
        ?>

				<?php 
        wolf_discography_get_template_part('content', 'release');
        ?>

			<?php 
    }
    ?>

		<?php 
    wolf_discography_loop_end();
    ?>

		<?php 
} else {
    ?>

			<?php 
    wolf_discography_get_template('loop/no-releases-found.php');
    ?>

		<?php 
}
/**
 * Pagination
 */
wolf_pagination($loop);
wolf_page_after();
// before page hook
get_footer('discography');
<?php

/**
 * The Template for displaying releases in a release category. Simply includes the archive template.
 *
 * Override this template by copying it to yourtheme/wolf-discography/taxonomy-band.php
 *
 * @author WpWolf
 * @package WolfDiscography/Templates
 * @since 1.0.2
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
wolf_discography_get_template('archive-release.php');
        /**
         * Shortcode
         *
         * @param array $atts
         * @return string
         */
        public function shortcode($atts)
        {
            extract(shortcode_atts(array('count' => 4, 'band' => null, 'label' => null, 'col' => 4), $atts));
            ob_start();
            $args = array('post_type' => array('release'), 'posts_per_page' => absint($count));
            if ($band) {
                $args['band'] = $band;
            }
            if ($label) {
                $args['label'] = $label;
            }
            $loop = new WP_Query($args);
            if ($loop->have_posts()) {
                ?>
				<ul class="shortcode-release-grid release-grid-col-<?php 
                echo absint($col);
                ?>
">
					<?php 
                while ($loop->have_posts()) {
                    $loop->the_post();
                    ?>

						<?php 
                    wolf_discography_get_template_part('content', 'release-shortcode');
                    ?>

					<?php 
                }
                ?>
				</ul><!-- .shortcode-release-grid -->
			<?php 
            } else {
                // no release
                ?>
				<?php 
                wolf_discography_get_template('loop/no-releases-found.php');
                ?>
			<?php 
            }
            wp_reset_postdata();
            $html = ob_get_contents();
            ob_end_clean();
            return $html;
        }