Example #1
0
<?php 
            // Post Image
            if ($udesign_options['display_post_image_in_single_post'] == 'yes') {
                display_post_image_fn($post->ID, false);
            }
            the_content(__('<p class="serif">Read the rest of this entry &raquo;</p>', 'udesign'));
            wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));
            ?>
                                <?php 
            echo do_shortcode('[divider]');
            ?>
                                <div class="postmetadata">
                                    <span>
<?php 
            if ($udesign_options['show_postmetadata_author'] == 'yes') {
                printf(__('By %1$s on %2$s ', 'udesign'), '</span>' . udesign_get_the_author_page_link() . '<span>', get_the_date());
            } else {
                printf(__('On %1$s ', 'udesign'), get_the_date());
            }
            ?>
                                    </span> &nbsp; / &nbsp; <span><?php 
            the_category(', ');
            ?>
</span> &nbsp; / &nbsp; <?php 
            comments_popup_link(__('Leave a comment', 'udesign'), __('1 Comment', 'udesign'), __('% Comments', 'udesign'));
            ?>
 <?php 
            edit_post_link(__('Edit', 'udesign'), '<div style="float:right;margin:0 10px;">', '</div>');
            ?>
  
<?php 
Example #2
0
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', $instance['title']);
        $category_id = $instance['category_id'];
        $num_posts = absint($instance['num_posts']);
        $post_offset = absint($instance['post_offset']);
        $num_words_limit = absint($instance['num_words_limit']);
        $show_date_author = isset($instance['show_date_author']) ? $instance['show_date_author'] : false;
        $show_more_link = isset($instance['show_more_link']) ? $instance['show_more_link'] : false;
        $show_thumbs = isset($instance['show_thumbs']) ? $instance['show_thumbs'] : false;
        $thumb_frame_shadow = isset($instance['thumb_frame_shadow']) ? $instance['thumb_frame_shadow'] : false;
        $post_thumb_width = absint($instance['post_thumb_width']);
        $post_thumb_height = absint($instance['post_thumb_height']);
        /* Before widget (defined by themes). */
        echo $before_widget;
        /* Display the widget title if one was input (before and after defined by themes). */
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        /* Display the Latest Posts accordinly... */
        $cats_to_include = $category_id ? "cat={$category_id}&" : '';
        $num_posts_query = new WP_Query("{$cats_to_include}showposts={$num_posts}&offset={$post_offset}");
        if ($num_posts_query->have_posts()) {
            ?>
		    <div class="latest_posts">
			<ul class="small-thumb">
<?php 
            while ($num_posts_query->have_posts()) {
                $num_posts_query->the_post();
                update_post_caches($posts);
                ?>
				<li>
<?php 
                if ($show_thumbs) {
                    include TEMPLATEPATH . '/scripts/post-thumbnail.php';
                }
                ?>
				    <a class="teaser-title" title="<?php 
                the_title();
                ?>
" href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a>
<?php 
                if ($show_date_author) {
                    ?>
                                        <div class="date-author"><?php 
                    printf(__('%1$s by %2$s ', 'udesign'), get_the_date(), udesign_get_the_author_page_link());
                    ?>
</div>
<?php 
                }
                ?>
				    <div class="teaser-content"><?php 
                if ($num_words_limit) {
                    echo custom_string_length_by_words(get_the_excerpt(), $num_words_limit) . '...';
                }
                ?>
</div>
<?php 
                if ($show_more_link) {
                    ?>
                                        <a title="<?php 
                    the_title_attribute();
                    ?>
" href="<?php 
                    the_permalink();
                    ?>
" class="read-more-align-right"><span><?php 
                    esc_html_e('Read more', 'udesign');
                    ?>
</span> &rarr;</a>
<?php 
                }
                ?>
				    <div class="clear"></div>
				</li>
<?php 
            }
            ?>
			</ul>
		    </div><!-- end widget_recent_posts -->
<?php 
        }
        wp_reset_postdata();
        /* After widget (defined by themes). */
        echo $after_widget;
    }