示例#1
0
/**
 * Gets tapestry callback function
 * @since 1.4.4
 */
function arras_get_tapestry_callback($type, $query, $taxonomy = 'category')
{
    global $arras_tapestries;
    if (count($arras_tapestries) == 0) {
        return false;
    }
    if ($arras_tapestries[$type]) {
        $tapestry = $arras_tapestries[$type];
    } else {
        $arr = array_values($arras_tapestries);
        $tapestry = $arr[0];
    }
    echo $tapestry->before;
    while ($query->have_posts()) {
        $query->the_post();
        call_user_func_array($tapestry->callback, array($dep = '', $taxonomy));
        if ($tapestry->allow_duplicates) {
            arras_blacklist_duplicates();
        }
    }
    echo $tapestry->after;
}
示例#2
0
/**
 * Gets tapestry callback function
 * @since 1.4.4
 */
function arras_get_tapestry_callback($type, $query, $taxonomy = 'category')
{
    global $arras_tapestries, $wp_query, $post;
    if (count($arras_tapestries) == 0) {
        return false;
    }
    if ($arras_tapestries[$type]) {
        $tapestry = $arras_tapestries[$type];
    } else {
        $arr = array_values($arras_tapestries);
        $tapestry = $arr[0];
    }
    echo $tapestry->before;
    if ($type == 'default') {
        $tapestry_settings = get_option('arras_tapestry_default');
        if (!isset($tapestry_settings['nodes']) || $tapestry_settings['nodes'] <= 0) {
            $tapestry_settings['nodes'] = 3;
        }
        $c = 0;
        for ($c; $query->have_posts(); $c++) {
            $query->the_post();
            if ($c % $tapestry_settings['nodes'] == 0) {
                echo '<div class="clearfix">';
            }
            // hack for plugin authors who love to use $post = $wp_query->post
            $wp_query->post = $query->post;
            setup_postdata($post);
            call_user_func_array($tapestry->callback, array($dep = '', $taxonomy));
            if ($tapestry->allow_duplicates) {
                arras_blacklist_duplicates();
            }
            if ($c % $tapestry_settings['nodes'] == $tapestry_settings['nodes'] - 1) {
                echo '</div>';
            }
        }
        if ($c % $tapestry_settings['nodes'] != 0) {
            echo '</div>';
        }
    } else {
        while ($query->have_posts()) {
            $query->the_post();
            // hack for plugin authors who love to use $post = $wp_query->post
            $wp_query->post = $query->post;
            setup_postdata($post);
            call_user_func_array($tapestry->callback, array($dep = '', $taxonomy));
            if ($tapestry->allow_duplicates) {
                arras_blacklist_duplicates();
            }
        }
    }
    echo $tapestry->after;
}
function arras_add_slideshow()
{
    global $post_blacklist, $paged;
    if (!is_home() || $paged) {
        return false;
    }
    $slideshow_cat = arras_get_option('slideshow_cat');
    if (arras_get_option('enable_slideshow') == false) {
        return false;
    }
    $query = arras_prep_query(array('list' => $slideshow_cat, 'taxonomy' => arras_get_option('slideshow_tax'), 'query' => array('posts_per_page' => arras_get_option('slideshow_count'), 'exclude' => $post_blacklist, 'post_type' => arras_get_option('slideshow_posttype'), 'paged' => $paged)));
    $q = new WP_Query(apply_filters('arras_slideshow_query', $query));
    if ($q->have_posts()) {
        ?>
 
	<!-- Featured Slideshow -->
	<div class="featured clearfix">
		<?php 
        if ($q->post_count > 1) {
            ?>
		<div id="controls">
			<a href="" class="prev"><?php 
            _e('Prev', 'arras');
            ?>
</a>
			<a href="" class="next"><?php 
            _e('Next', 'arras');
            ?>
</a>
		</div>
		<?php 
        }
        ?>
		<div id="featured-slideshow">
			<?php 
        $count = 0;
        ?>
		
			<?php 
        while ($q->have_posts()) {
            $q->the_post();
            ?>
			<div class="featured-slideshow-inner" <?php 
            if ($count != 0) {
                echo 'style="display: none"';
            }
            ?>
>
				<a class="featured-article" href="<?php 
            the_permalink();
            ?>
" rel="bookmark">
				<?php 
            echo arras_get_thumbnail('featured-slideshow-thumb');
            ?>
				</a>
				<div class="featured-entry">
					<a class="entry-title" href="<?php 
            the_permalink();
            ?>
" rel="bookmark"><?php 
            the_title();
            ?>
</a>
					<div class="entry-summary"><?php 
            the_excerpt();
            ?>
</div>
					<div class="progress"></div>
				</div>
			</div>
			<?php 
            arras_blacklist_duplicates();
            // required for duplicate posts function to work.
            $count++;
        }
        ?>
		</div>
	</div>
	<?php 
    }
}
示例#4
0
/**
 * Gets tapestry callback function
 * @since 1.4.4
 */
function arras_get_tapestry_callback($type, $query, $taxonomy = 'category')
{
    global $arras_tapestries, $wp_query, $post;
    if (count($arras_tapestries) == 0) {
        return false;
    }
    if ($arras_tapestries[$type]) {
        $tapestry = $arras_tapestries[$type];
    } else {
        $arr = array_values($arras_tapestries);
        $tapestry = $arr[0];
    }
    echo $tapestry->before;
    if ($type == 'default') {
        $nodes = arras_get_nodes();
        add_filter('arras_post_class', 'arras_add_node_width_class');
        $c = 0;
        for ($c; $query->have_posts(); $c++) {
            $query->the_post();
            if ($c % $nodes == 0) {
                echo '<div class="group node-group">';
            }
            // hack for plugin authors who love to use $post = $wp_query->post
            $wp_query->post = $query->post;
            setup_postdata($post);
            call_user_func_array($tapestry->callback, array($dep = '', $taxonomy));
            if ($tapestry->allow_duplicates) {
                arras_blacklist_duplicates();
            }
            if ($c % $nodes == $nodes - 1) {
                echo '</div>';
            }
        }
        if ($c % $nodes != 0) {
            echo '</div>';
        }
        remove_filter('arras_post_class', 'arras_add_node_width_class');
    } else {
        while ($query->have_posts()) {
            $query->the_post();
            // hack for plugin authors who love to use $post = $wp_query->post
            $wp_query->post = $query->post;
            setup_postdata($post);
            call_user_func_array($tapestry->callback, array($dep = '', $taxonomy));
            if ($tapestry->allow_duplicates) {
                arras_blacklist_duplicates();
            }
        }
    }
    echo $tapestry->after;
}
示例#5
0
function arras_add_slideshow()
{
    global $post_blacklist, $paged;
    if (!is_home() || $paged) {
        return false;
    }
    // if we're not on the first page of the homepage, quit
    if (false === arras_get_option('enable_slideshow')) {
        return false;
    }
    // if the slideshow option is disabled, quit
    $slideshow_cat = arras_get_option('slideshow_cat');
    $query = arras_prep_query(array('list' => $slideshow_cat, 'taxonomy' => arras_get_option('slideshow_tax'), 'query' => array('posts_per_page' => arras_get_option('slideshow_count'), 'exclude' => $post_blacklist, 'post_type' => arras_get_option('slideshow_posttype'), 'paged' => $paged)));
    $q = new WP_Query(apply_filters('arras_slideshow_query', $query));
    if ($q->have_posts()) {
        ?>
	<!-- Featured Slideshow -->
	<div class="featured group">
		<div id="controls" class="slide-controls">
			<div class="cycle-prev"><?php 
        _e('Prev', 'arras');
        ?>
</div>
			<div class="cycle-next"><?php 
        _e('Next', 'arras');
        ?>
</div>
		</div>
		<div id="featured-slideshow" class="cycle-slideshow"
				data-cycle-slides='> a'
				data-cycle-swipe=true
				data-cycle-swipe-fx=scrollHorz
				data-cycle-speed=1000
				data-cycle-prev=".cycle-prev"
				data-cycle-next=".cycle-next"
				data-cycle-auto-height="16:9"
				data-cycle-caption-plugin="caption2"
				data-cycle-overlay-template="<a href={{link}}><h3 class=entry-title>{{title}}</h3><div class=entry-summary>{{excerpt}}</div>">
			<?php 
        $count = 0;
        ?>
			<div class="cycle-overlay custom"></div>
			<?php 
        while ($q->have_posts()) {
            $q->the_post();
            ?>
				<?php 
            echo arras_make_slide();
            ?>
			<?php 
            arras_blacklist_duplicates();
            // required for duplicate posts function to work.
            ?>
			<?php 
            $count++;
        }
        ?>
		</div>
	</div>
	<?php 
    }
}