Beispiel #1
0
                ?>
	    <div class="entry-content">
		<?php 
                weaver_the_content_featured();
                ?>
		<?php 
                wp_link_pages(array('before' => '<div class="page-link">' . __('Pages:', WEAVER_TRANS), 'after' => '</div>'));
                ?>

	    </div><!-- .entry-content -->
	<?php 
            } elseif ($weaver_loop == 'excerpt') {
                ?>
		<div class="entry-summary">
		<?php 
                weaver_the_excerpt_featured();
                ?>
		<?php 
                wp_link_pages(array('before' => '<div class="page-link">' . __('Pages:', WEAVER_TRANS), 'after' => '</div>'));
                ?>
	    </div><!-- .entry-summary -->
	<?php 
            } else {
                ?>
	<?php 
            }
            if (!weaver_is_checked_page_opt('ttw_hide_pp_infobot')) {
                weaver_posted_in('blog');
            } else {
                echo '<div style="clear:both;"></div>';
            }
function weaver_show_posts_shortcode($args = '')
{
    /* implement [weaver_get_posts opt1="val1" opt2="value"] shortcode */
    /* DOC NOTES:
    CSS styling: The group of posts will be wrapped with a <div> with a class called
    .wvr-show-posts. You can add an additional class to that by providing a 'class=classname' option
    (without the leading '.' used in the actual CSS definition). You can also provide inline styling
    by providing a 'style=value' option where value is whatever styling you need, each terminated
    with a semi-colon (;).
    
    The optional header is in a <div> called .wvr_show_posts_header. You can add an additional class
    name with 'header_class=classname'. You can provide inline styling with 'header_style=value'.
    
    .wvr-show-posts .hentry {margin-top: 0px; margin-right: 0px; margin-bottom: 40px; margin-left: 0px;}
    .widget-area .wvr-show-posts .hentry {margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;}
    */
    global $more;
    global $weaver_cur_post_id;
    extract(shortcode_atts(array('cats' => '', 'tags' => '', 'author' => '', 'single_post' => '', 'orderby' => 'date', 'sort' => 'DESC', 'number' => '5', 'show' => 'full', 'hide_title' => '', 'hide_top_info' => '', 'hide_bottom_info' => '', 'show_featured_image' => '', 'show_avatar' => '', 'show_bio' => '', 'excerpt_length' => '', 'style' => '', 'class' => '', 'header' => '', 'header_style' => '', 'header_class' => '', 'more_msg' => ''), $args));
    $save_cur_post = $weaver_cur_post_id;
    $save_excerpt_length = weaver_getopt('ttw_excerpt_length');
    if (!empty($excerpt_length)) {
        weaver_setopt('ttw_excerpt_length', $excerpt_length);
    }
    $save_more_msg = weaver_getopt('ttw_excerpt_more_msg');
    if (!empty($more_msg)) {
        weaver_setopt('ttw_excerpt_more_msg', $more_msg);
    }
    /* Setup query arguments using the supplied args */
    $qargs = array('ignore_sticky_posts' => 1);
    $qargs['orderby'] = $orderby;
    /* enter opts that have defaults first */
    $qargs['order'] = $sort;
    $qargs['posts_per_page'] = $number;
    if (!empty($cats)) {
        $qargs['cat'] = weaver_cat_slugs_to_ids($cats);
    }
    if (!empty($tags)) {
        $qargs['tag'] = $tags;
    }
    if (!empty($single_post)) {
        $qargs['name'] = $single_post;
    }
    if (!empty($author)) {
        $qargs['author_name'] = $author;
    }
    $ourposts = new WP_Query($qargs);
    // now modify the query using custom fields for this page
    /* now start the content */
    $div_add = '';
    if (!empty($style)) {
        $div_add = ' style="' . $style . '"';
    }
    $content = '<div class="wvr-show-posts ' . $class . '"' . $div_add . '/>';
    $h_add = '';
    if (!empty($header_style)) {
        $h_add = ' style="' . $header_style . '"';
    }
    if (!empty($header)) {
        $content .= '<div class="wvr-show-posts-header ' . $header_class . '"' . $h_add . '>' . $header . '</div>';
    }
    ob_start();
    // use built-in weaver code to generate a weaver standard post
    while ($ourposts->have_posts()) {
        $ourposts->the_post();
        $weaver_cur_post_id = get_the_ID();
        weaver_per_post_style();
        if (!is_sticky()) {
            ?>
	<div id="post-<?php 
            the_ID();
            ?>
" <?php 
            post_class();
            ?>
>
	<?php 
            if (empty($hide_title)) {
                ?>
	<h2 class="entry-title"><?php 
                weaver_post_title();
                ?>
</h2>
	<?php 
            }
            ?>

	<?php 
            if (empty($hide_top_info)) {
                weaver_posted_on('blog');
            }
            if ($show == 'excerpt') {
                /* excerpt? */
                ?>
		<div class="entry-summary">
		<?php 
                weaver_the_excerpt_featured(true, !empty($show_featured_image));
                ?>
		</div><!-- .entry-summary -->

	<?php 
            } else {
                if ($show != 'title') {
                    ?>
		<div class="entry-content">
		<?php 
                    $more = false;
                    // let <!-- more --> work, still use single
                    weaver_the_content_featured_single(!empty($show_featured_image));
                    ?>
		</div><!-- .entry-content -->
	<?php 
                }
            }
            if (!empty($show_bio) && get_the_author_meta('description')) {
                // If a user has filled out their description, show a bio on their entries
                ?>
		<div id="entry-author-info">
		    <div id="author-avatar">
			<?php 
                echo get_avatar(get_the_author_meta('user_email'), apply_filters('weaver_author_bio_avatar_size', 60));
                ?>
		    </div><!-- #author-avatar -->
		    <div id="author-description">
			<h2><?php 
                printf(esc_attr__('About %s', WEAVER_TRANS), get_the_author());
                ?>
</h2>
			<?php 
                the_author_meta('description');
                ?>
			<div id="author-link">
			    <a href="<?php 
                echo get_author_posts_url(get_the_author_meta('ID'));
                ?>
">
				<?php 
                printf(__('View all posts by %s <span class="meta-nav">&rarr;</span>', WEAVER_TRANS), get_the_author());
                ?>
			    </a>
			</div><!-- #author-link	-->
		    </div><!-- #author-description -->
		</div><!-- #entry-author-info -->
	<?php 
            }
            if (empty($hide_bottom_info)) {
                weaver_posted_in('blog');
            } else {
                echo '<div style="clear:both;"></div>';
            }
            ?>
	</div><!-- #post-## -->
	<?php 
        }
        // end !sticky
    }
    // end loop
    $content .= ob_get_clean();
    // get the output
    // get posts
    $content .= '</div><!-- #wvr-show-posts -->';
    wp_reset_query();
    $weaver_cur_post_id = $save_cur_post;
    weaver_setopt('ttw_excerpt_length', $save_excerpt_length);
    weaver_setopt('ttw_excerpt_more_msg', $save_more_msg);
    return $content;
}