Exemple #1
0
function pw_posts_featured()
{
    echo pw_function_handle(__FUNCTION__);
    global $pw;
    $rightcon = '';
    $bool = true;
    if (function_exists('has_post_thumbnail') && has_post_thumbnail() && (function_exists('has_post_format') && !has_post_format('gallery') && !has_post_format('video') && !has_post_format('image'))) {
        echo '<a href="' . get_permalink() . '" class="image-anchor">';
        if ($pw == 1) {
            $thumb = 'sticky';
            $class = 'alignnone';
        } else {
            $thumb = 'thumbnail';
            $class = 'alignleft';
        }
        the_post_thumbnail($thumb, array('class' => $class));
        echo '</a>';
        $rightcon = ' class="content-col"';
    } else {
        if (has_post_format("image")) {
            $bool = false;
        }
    }
    ?>
    <div<?php 
    echo $rightcon;
    ?>
>
		<?php 
    pw_post_header();
    ?>
		<?php 
    pw_post_content($bool);
    ?>
	</div> 
<?php 
}
Exemple #2
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
        $sticky = get_option('sticky_posts');
        $par = array("posts_per_page" => $instance['number'], "cat" => $instance['category'], "post__not_in" => $sticky);
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        $featuredPosts = new WP_Query();
        $featuredPosts->query($par);
        ?>
		<?php 
        $i = 1;
        ?>
	    <?php 
        while ($featuredPosts->have_posts()) {
            $featuredPosts->the_post();
            ?>
	    <article id="post-<?php 
            the_ID();
            ?>
" <?php 
            post_class('side-featured');
            ?>
>
			<?php 
            $rightcon = '';
            if (function_exists('has_post_thumbnail') && has_post_thumbnail() && (function_exists('has_post_format') && !has_post_format('gallery') && !has_post_format('video'))) {
                echo '<a href="' . get_permalink() . '">';
                the_post_thumbnail('fifty', array('class' => 'alignleft'));
                echo '</a>';
                $rightcon = ' class="content-col"';
            }
            ?>
		    <div<?php 
            echo $rightcon;
            ?>
>
				<header>
					<h1 class="posttitle"><a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            printf(esc_attr__('Permalink to %s', "presswork"), the_title_attribute('echo=0'));
            ?>
" rel="bookmark"><?php 
            the_title();
            ?>
</a></h1>
					<div class="meta">
						<?php 
            the_time(get_option('date_format'));
            ?>
					</div>
				</header>
				<?php 
            pw_post_content(true, 15, true, true);
            ?>
			</div> 
		</article>
	    <?php 
        }
        echo $after_widget;
    }