if (is_single()) {
    the_title('<h1 class="entry-title">', '</h1>');
} else {
    the_title(sprintf('<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>');
}
?>
		</header><!-- .entry-header -->
		
		<div class="entry-content clearfix">
			<div class="article-text">
			<?php 
$thumb_url = '';
$title_attribute = esc_attr(get_the_title($post->ID));
$thumb_url = wp_get_attachment_thumb_url(get_post_thumbnail_id($post->ID));
if ($thumb_url == "") {
    $thumb_url = catch_first_image_in_content(get_the_content($post->ID));
}
//echo "thumb_url:" . $thumb_url;
if ($thumb_url != "") {
    ?>
					<div class="item-image intro img-intro-left">
						<a href="<?php 
    echo get_permalink();
    ?>
" title="<?php 
    echo the_title('', '', false);
    ?>
">
							<img data-original="<?php 
    echo $thumb_url;
    ?>
    /** @see WP_Widget::widget -- do not rename this */
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $message = $instance['message'];
        ?>
        <?php 
        echo $before_widget;
        ?>
        <?php 
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
        <div class="rpwe-block ">
            <ul class="rpwe-ul">
            <?php 
        global $wp_query;
        $current_post_id = $wp_query->get_queried_object_id();
        $post_not_in = get_option('sticky_posts');
        $post_not_in[] = $current_post_id;
        $args = array('post_type' => 'post', 'post_status' => 'publish', 'post__not_in' => $post_not_in, 'posts_per_page' => 5, 'order' => 'DESC', 'orderby' => 'date');
        $queryObj = new WP_Query($args);
        if ($queryObj->have_posts()) {
            while ($queryObj->have_posts()) {
                $queryObj->the_post();
                $thumb_url = wp_get_attachment_thumb_url(get_post_thumbnail_id($queryObj->post->ID));
                if ($thumb_url == "") {
                    $thumb_url = catch_first_image_in_content($queryObj->post->post_content, 40, 40);
                }
                ?>
                        <li class="rpwe-li rpwe-clearfix" id="<?php 
                print_r(get_option('sticky_posts'));
                ?>
">
                            <a class="rpwe-img" href="<?php 
                the_permalink();
                ?>
" title="<?php 
                echo the_title_attribute('echo=0');
                ?>
" rel="bookmark">
                                <img class="rpwe-alignleft rpwe-thumb" src="<?php 
                echo $thumb_url;
                ?>
" alt="<?php 
                echo the_title_attribute('echo=0');
                ?>
" width="40">
                            </a>
                            <h3 class="rpwe-title">
                                <a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                echo the_title_attribute('echo=0');
                ?>
" rel="bookmark"><?php 
                the_title();
                ?>
</a>
                            </h3>
                            <time class="rpwe-time published" datetime="<?php 
                the_time('c');
                ?>
"><?php 
                echo date('d/m/Y', strtotime($queryObj->post->post_date));
                ?>
</time>
                        </li>
            <?php 
            }
        }
        ?>
            </ul>
        </div>
        <!-- End Recent Posts -->

        <?php 
        echo $after_widget;
        ?>
        <?php 
    }
Exemplo n.º 3
0
?>
</h3>
				</div>
				<br>
			</header><!-- .entry-header -->
			<?php 
$args = array('numberposts' => '6');
$recent_posts = wp_get_recent_posts($args);
$i = 0;
foreach ($recent_posts as $recent) {
    //print_r( $recent ); return;
    $css_first_col = $i % 2 == 0 ? "first-col" : "";
    $title_attribute = esc_attr($recent["post_title"]);
    $thumb_url = wp_get_attachment_thumb_url(get_post_thumbnail_id($recent["ID"]));
    if ($thumb_url == "") {
        $thumb_url = catch_first_image_in_content($recent["post_content"]);
    }
    ?>
			<div class="one_half columns page-id-<?php 
    echo $recent["ID"];
    ?>
">
			    <div class="recent-item <?php 
    echo $css_first_col;
    ?>
">
			    	<h3 class="recent-title"><a href="<?php 
    echo get_permalink($recent["ID"]);
    ?>
" title="<?php 
    echo $title_attribute;