コード例 #1
0
        /**
         * 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;
        }
コード例 #2
0
/* Release Post Loop */
$loop = new WP_Query($args);
if ($loop->have_posts()) {
    ?>

		<?php 
    wolf_discography_loop_start();
    ?>

			<?php 
    while ($loop->have_posts()) {
        $loop->the_post();
        ?>

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

			<?php 
    }
    ?>

		<?php 
    wolf_discography_loop_end();
    ?>

		<?php 
} else {
    ?>

			<?php 
コード例 #3
0
<?php

/**
 * The discography loop
 *
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
$layout = wolf_get_theme_option('release_type');
if ('full' == $layout || 'full-alt' == $layout || 'sidebar' == $layout || '' == $layout) {
    $layout = 'classic';
}
wolf_discography_get_template_part('content', 'release-' . $layout);