Advertisement
Guest User

Custom Field Excerpt

a guest
Mar 22nd, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3. * The loop that displays posts.
  4. *
  5. * The loop displays the posts and the post content. See
  6. * http://codex.wordpress.org/The_Loop to understand it and
  7. * http://codex.wordpress.org/Template_Tags to understand
  8. * the tags used in it.
  9. */
  10. ?>
  11.  
  12. <?php /* If there are no posts to display, such as an empty archive page */ ?>
  13. <?php if ( ! $wp_query->have_posts() ) : ?>
  14. <div id="post-0" class="post clearfix error404 not-found post-no-image">
  15. <div class="post-content-wrapper">
  16. <h2 class="post-title"><?php _e( 'Not Found', 'unisphere' ); ?></h2>
  17. <div class="post-text">
  18. <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'unisphere' ); ?></p>
  19. <?php get_search_form(); ?>
  20. </div>
  21. </div>
  22. </div>
  23. <?php endif; ?>
  24.  
  25. <?php
  26. /*
  27. * Start the Loop.
  28. */ ?>
  29. <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
  30.  
  31.  
  32. <?php /** EDIT See if we want the Content or excerpt? */ ?>
  33. <?php
  34. global $post;
  35. $excerpt = get_metadata( $post->ID,'excerpt', true );
  36. ?>
  37. <?php /** EDIT added condition $excerpt below */ ?>
  38.  
  39. <?php if( !$excerpt || $unisphere_options['show_blog_full'] != '1') : // User has not checked the option to display full posts in the blog, so use the excerpt template... ?>
  40.  
  41. <div id="post-<?php the_ID(); ?>" class="post-excerpt clearfix <?php semantic_entries(); ?><?php if( unisphere_get_post_image("blog") == '' ) echo ' post-no-image'; ?>">
  42.  
  43. <div class="post-image">
  44.  
  45. <a href="<?php the_permalink(); ?>"><?php echo unisphere_get_post_image("blog"); ?></a>
  46.  
  47. <?php if( 'open' == $post->comment_status ) : ?>
  48. <?php comments_popup_link( __( 'Leave a comment', 'unisphere' ), __( '1 Comment', 'unisphere' ), __( '% Comments', 'unisphere' ), 'comment-count button-unselected rounded-all' ); ?>
  49. <?php endif; ?>
  50.  
  51. <a href="<?php the_permalink(); ?>" class="more-link button rounded-all"><?php _e( 'Read more &raquo;', 'unisphere' ); ?></a>
  52.  
  53. </div>
  54.  
  55. <div class="post-content-wrapper">
  56.  
  57.  
  58. <h2 class="post-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'unisphere' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  59.  
  60. <div class="post-meta rounded-all">
  61.  
  62. <?php printf( __( '<span class="published">Posted on %1$s</span> <span class="author">by %2$s</span>', 'unisphere' ),
  63. sprintf( '<abbr class="published-time" title="%1$s">%2$s</abbr>',
  64. esc_attr( get_the_time() ),
  65. get_the_date()
  66. ),
  67. sprintf( '<a class="url fn n" href="%1$s" title="%2$s">%3$s</a>',
  68. get_author_posts_url( get_the_author_meta( 'ID' ) ),
  69. sprintf( esc_attr__( 'View all posts by %s', 'unisphere' ), get_the_author() ),
  70. get_the_author()
  71. )
  72. ); ?>
  73.  
  74. <br />
  75.  
  76.  
  77. <?php
  78. $tags_list = get_the_tag_list( '', ', ' );
  79. if ( $tags_list ) : ?>
  80. <span class="post-tags"><?php printf( __( 'Tagged %s', 'unisphere' ), $tags_list ); ?></span>
  81. <?php endif; ?>
  82.  
  83. </div>
  84.  
  85. <div class="post-text">
  86. <?php the_excerpt(); ?>
  87. </div>
  88.  
  89. </div>
  90.  
  91. </div>
  92.  
  93. <?php else : // User wants to display full post content ?>
  94.  
  95. <!--BEGIN .post-detail-->
  96. <div id="post-<?php the_ID(); ?>" class="post-full clearfix <?php semantic_entries(); ?><?php if( unisphere_get_post_image("blog-detail") == '' ) echo ' post-no-image'; ?>">
  97.  
  98. <h5><?php the_subheading(); ?></h5><br><h2 class="post-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'unisphere' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2><br>
  99.  
  100. <div class="post-image">
  101. <a href="<?php the_permalink(); ?>"><?php echo unisphere_get_post_image("blog-detail"); ?></a>
  102. </div>
  103.  
  104. <div class="post-meta rounded-all">
  105.  
  106. <?php printf( __( '<span class="published">Posted on %1$s</span> <span class="author">by %2$s</span>', 'unisphere' ),
  107. sprintf( '<abbr class="published-time" title="%1$s">%2$s</abbr>',
  108. esc_attr( get_the_time() ),
  109. get_the_date()
  110. ),
  111. sprintf( '<a class="url fn n" href="%1$s" title="%2$s">%3$s</a>',
  112. get_author_posts_url( get_the_author_meta( 'ID' ) ),
  113. sprintf( esc_attr__( 'View all posts by %s', 'unisphere' ), get_the_author() ),
  114. get_the_author()
  115. )
  116. ); ?><?php edit_post_link('Editar',' ',''); ?>
  117.  
  118. <br />
  119.  
  120.  
  121.  
  122. <?php
  123. $tags_list = get_the_tag_list( '', ', ' );
  124. if ( $tags_list ) : ?>
  125. <span class="post-tags"><?php printf( __( 'Tagged %s', 'unisphere' ), $tags_list ); ?></span>
  126. <?php endif; ?>
  127.  
  128. <div class="share-buttons">
  129. <?php if ( $unisphere_options['show_blog_tweet_button'] == '1' ) : ?>
  130. <a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php echo get_permalink(); ?>" data-count="horizontal">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
  131. <?php endif; ?>
  132. <?php if ( $unisphere_options['show_blog_fb_like_button'] == '1' ) : ?>
  133. <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo rawurlencode(get_permalink()); ?>&amp;layout=standard&amp;show_faces=false&amp;width=350&amp;action=like&amp;colorscheme=<?php if( strpos($unisphere_options['skin'], 'dark') === 0 || strpos($unisphere_options['skin'], 'extra_dark') === 0 ) echo 'dark'; else echo 'light'; ?>&amp;height=20" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:350px; height:20px;" allowTransparency="true" class="facebook-like-button"></iframe><g:plusone size="medium"></g:plusone>
  134. <?php endif; ?>
  135. </div>
  136.  
  137. </div>
  138.  
  139. <div class="post-text">
  140. <?php the_content('more'); ?>
  141. <?php wp_link_pages('before=<div class="wp-pagenavi post_linkpages">&after=</div><br />&link_before=<span>&link_after=</span>'); ?>
  142. <?php if( 'open' == $post->comment_status ) : ?>
  143. <?php comments_popup_link( __( 'Leave a comment', 'unisphere' ), __( '1 Comment', 'unisphere' ), __( '% Comments', 'unisphere' ), 'comment-count button-unselected rounded-all' ); ?>
  144. <?php endif; ?>
  145. </div>
  146.  
  147. <!--END .post-detail-->
  148. </div>
  149. <?php endif; ?>
  150.  
  151. <div class="hr"><hr /></div>
  152.  
  153. <?php endwhile; // End the loop. Whew. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement