<?php
/**
 * This file is used for your standard post entry
 * @package Ultra WordPress Theme
 * @since 1.0
 * @author AJ Clarke : http://wpexplorer.com
 * @copyright Copyright (c) 2012, AJ Clarke
 * @link http://wpexplorer.com
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 */
 
 

/******************************************************
 * Single Posts
 * @since 1.0
*****************************************************/
if ( is_singular() && is_main_query() ) {
	
	// Show post thumbnail
    if( has_post_thumbnail() && of_get_option('blog_post_thumbnail','1') == '1' ) { ?>
        <div id="blog-post-thumbnail">
            <img src="<?php echo aq_resize( wp_get_attachment_url( get_post_thumbnail_id() ),  wpex_img( 'blog_post_width' ), wpex_img( 'blog_post_height' ), wpex_img( 'blog_post_crop' ) ); ?>" alt="<?php echo the_title(); ?>" />
        </div><!-- #blog-post-thumbnail -->
    <?php }

			
/******************************************************
 * Entries
 * @since 1.0
*****************************************************/
} else { ?>
<article <?php post_class('blog-entry blog-entry-with-icon clearfix '. of_get_option('blog_entry_style','large_image') ); ?>>
	<?php
	// Show post thumbnail
	if( has_post_thumbnail() ) { ?>
		<div class="blog-entry-media">
            <a href="<?php echo get_post_meta( get_the_ID(), 'wpex_post_url', true ); ?>" title="<?php the_title(); ?>" class="blog-entry-img" target="blank">
                <img src="<?php echo aq_resize( wp_get_attachment_url( get_post_thumbnail_id() ),  wpex_img( 'recent_posts_entry_width' ), wpex_img( 'recent_posts_entry_height' ), wpex_img( 'recent_posts_entry_crop' ) ); ?>" alt="<?php echo the_title(); ?>" />
            </a>
		</div><!-- .blog-entry-media -->
	<?php } ?>
	
	<div class="blog-entry-details clearfix <?php if( !has_post_thumbnail() ) echo 'full-width-blog-entry'; ?>">
    
		<header class="blog-entry-title">
			<h2><a href="<?php echo get_post_meta( get_the_ID(), 'wpex_post_url', true ); ?>" title="<?php the_title(); ?>" target="_blank"><?php the_title(); ?></a></h2>
			<?php if ( get_post_meta( get_the_ID(), 'wpex_post_url', true ) !== '' ) { ?>
                <ul class="entry-meta clearfix">
                    <li class="meta-url"><a href="<?php echo get_post_meta( get_the_ID(), 'wpex_post_url', true ); ?>" title="<?php the_title(); ?>" target="_blank"><?php echo get_post_meta( get_the_ID(), 'wpex_post_url', true ); ?></a></li>
                </ul><!-- .post-meta -->
             <?php } ?>
            <div class="blog-entry-icon"><span class="icon-link"></span></div>
		</header><!-- .blog-entry-title -->
        
        <div class="blog-entry-excerpt">
			<?php
            // Excerpt
            if( of_get_option( 'blog_entry_excerpt', '1' ) == '1' ) {
                    echo wp_trim_words( strip_shortcodes( get_the_content() ), of_get_option( 'blog_entry_excerpt_trim', '15' ) );
					// Read more link 
					if ( of_get_option('blog_entry_readmore','1' ) == '1' ) { ?>
						<br />
						<a href="<?php echo get_post_meta( get_the_ID(), 'wpex_post_url', true ); ?>" title="<?php the_title(); ?>" class="blog-entry-readmore" target="_blank"><?php _e('visit url','wpex'); ?> &rarr;</a>
					<?php }
                } else {
                    the_content('');
            } ?>
		</div><!-- .blog-entry-excerpt -->
	</div><!-- .blog-entry-details -->
</article><!-- .blog-entry -->
<?php } ?>