WordPress.org

Ready to get started?Download WordPress

Forums

Show full post content in categories (3 posts)

  1. ohheydoctor
    Member
    Posted 1 year ago #

    I need to show full posts within the categories and search results of my site instead of the excerpt.

    Note: I've already done many searches about this topic and have tried replacing the_excerpt() with the_content() and have had no luck.

    Site name: ohheydoctor.com
    Theme: Boulevard

    Here is my archive.php:

    <?php get_header(); ?>
    
    		<div id="main">
    
    			<div id="archive-title">
    
    				<span>
    					<?php _e('Browsing', 'pyre'); ?>
    					<?php if(is_category()): ?><?php _e('Category', 'pyre'); ?><?php endif; ?>
    					<?php if(is_tag()): ?><?php _e('Tag', 'pyre'); ?><?php endif; ?>
    					<?php if(is_author()): ?><?php _e('Author', 'pyre'); ?><?php endif; ?>
    					<?php if(is_year()): ?><?php _e('Yearly Archive', 'pyre'); ?><?php endif; ?>
    					<?php if(is_month()): ?><?php _e('Monthly Archive', 'pyre'); ?><?php endif; ?>
    					<?php if(is_day()): ?><?php _e('Daily Archive', 'pyre'); ?><?php endif; ?>
    				</span>
    
    				<?php if(is_category() || is_tag()): ?><h1><?php single_cat_title(); ?></h1><?php endif; ?>
    				<?php if(is_author()): ?>
    					<?php
    					if(isset($_GET['author_name'])) :
    					$curauth = get_userdatabylogin($author_name);
    					else :
    					$curauth = get_userdata($author);
    					endif;
    					?>
    					<h1><?php echo $curauth->user_nicename; ?></h1>
    				<?php endif; ?>
    				<?php if(is_year()): ?><?php echo get_the_date('Y'); ?><?php endif; ?>
    				<?php if(is_month()): ?><?php echo get_the_date('F Y'); ?><?php endif; ?>
    				<?php if(is_day()): ?><?php echo get_the_date(); ?><?php endif; ?>
    			</div>
    
    			<div id="items-wrapper">
    
    				<?php $count = 1; ?>
    				<?php while(have_posts()): the_post(); ?>
    				<?php if($count == 3): $count = 1; endif; if($count == 2): $class = 'last'; else: $class = ''; endif; ?>
    				<div class="item <?php echo $class; ?>">
    
    					<?php if(has_post_thumbnail()): ?>
    					<div class="item-thumb">
    						<?php
    						if(has_post_format('video') || has_post_format('audio') || has_post_format('gallery')) {
    							$icon = '<span class="thumb-icon ' . get_post_format($post->ID) . '"></span>';
    						} else {
    							$icon = '';
    						}
    						echo $icon;
    						?>
    						<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail('archive-image'); ?></a>
    						<span class="comments"><?php comments_popup_link('0', '1', '%'); ?></span>
    						<?php if(get_post_meta($post->ID, 'pyre_overall_score', true)): ?>
    						<span class="item-review"><img src="<?php echo get_template_directory_uri(); ?>/images/stars/<?php echo get_post_meta($post->ID, 'pyre_overall_score', true); ?>.png" alt="<?php the_title(); ?> Overall Score" /></span>
    						<?php endif; ?>
    					</div>
    					<?php endif; ?>
    
    					<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
    					<p><?php echo string_limit_words(get_the_excerpt(), 25); ?></p>
    
    					<div class="item-meta">
    						<span class="date"><?php the_time('F d, Y'); ?></span>
    						<span class="category"><?php the_category(', '); ?></span>
    					</div>
    
    				</div>
    				<?php $count++; endwhile; ?>
    
    			</div>
    
    			<?php kriesi_pagination($pages = '', $range = 2); ?>
    
    		</div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Here is my search.php:

    <?php get_header(); ?>
    
    		<div id="main">
    
    			<div id="archive-title">
    
    				<span><?php _e('Search results for', 'pyre'); ?></span>
    				<h1><?php echo get_search_query(); ?></h1>
    
    			</div>
    
    			<div id="items-wrapper">
    
    				<?php $count = 1; ?>
    				<?php while(have_posts()): the_post(); ?>
    				<?php if($count == 3): $count = 1; endif; if($count == 2): $class = 'last'; else: $class = ''; endif; ?>
    				<div class="item <?php echo $class; ?>">
    
    					<?php if(has_post_thumbnail()): ?>
    					<div class="item-thumb">
    						<?php
    						if(has_post_format('video') || has_post_format('audio') || has_post_format('gallery')) {
    							$icon = '<span class="thumb-icon ' . get_post_format($post->ID) . '"></span>';
    						} else {
    							$icon = '';
    						}
    						echo $icon;
    						?>
    						<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail('archive-image'); ?></a>
    						<span class="comments"><?php comments_popup_link('0', '1', '%'); ?></span>
    						<?php if(get_post_meta($post->ID, 'pyre_overall_score', true)): ?>
    						<span class="item-review"><img src="<?php echo get_template_directory_uri(); ?>/images/stars/<?php echo get_post_meta($post->ID, 'pyre_overall_score', true); ?>.png" alt="<?php the_title(); ?> Overall Score" /></span>
    						<?php endif; ?>
    					</div>
    					<?php endif; ?>
    
    					<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
    					<p><?php echo string_limit_words(get_the_excerpt(), 25); ?></p>
    
    					<div class="item-meta">
    						<span class="date"><?php the_time('F d, Y'); ?></span>
    						<span class="category"><?php the_category(', '); ?></span>
    					</div>
    
    				</div>
    				<?php $count++; endwhile; ?>
    
    			</div>
    
    			<?php kriesi_pagination($pages = '', $range = 2); ?>
    
    		</div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Index.php:

    <?php get_header(); ?>
    
    		<div id="main">
    
    			<?php if(get_option('pyre_featured_slider') == 'On' && get_option('pyre_featured_tag')): ?>
    			<?php
    			$featured_posts = new WP_Query(array(
    				'showposts' => get_option('pyre_featured_posts'),
    				'tag' => get_option('pyre_featured_tag')
    			));
    			?>
    			<div id="featured-wrapper">
    
    				<div class="slider-item">
    
    					<?php while($featured_posts->have_posts()): $featured_posts->the_post(); ?>
    					<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'slider-image'); ?>
    					<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>" title="#htmlcaption_<?php echo $post->ID; ?>"/></a>
    					<?php endwhile; ?>
    
    				</div>
    
    				<?php while($featured_posts->have_posts()): $featured_posts->the_post(); ?>
    				<div id="htmlcaption_<?php echo $post->ID; ?>" class="slider-text nivo-html-caption">
    
    					<span class="category"><?php the_category(', '); ?></span>
    					<span class="date"><?php the_time('F d, Y'); ?></span>
    
    					<div class="slider-heading">
    
    						<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    						<p><?php echo string_limit_words(get_the_excerpt(), 40); ?></p>
    
    					</div>
    
    				</div>
    				<?php endwhile; ?>
    
    			</div>
    			<?php endif; ?>
    
    			<?php if(get_option('pyre_homepage_style') == 'blog'): ?>
    				<?php while(have_posts()): the_post(); ?>
    
    				<div id="post-wrapper" <?php post_class('homepage-post-wrapper'); ?>>
    
    					<div id="post-header">
    
    						<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
    
    						<span class="post-comment-box"><?php comments_popup_link('0', '1', '%'); ?></span>
    
    						<div class="post-meta">
    							<span class="author"><?php the_author_posts_link() ?></span>
    							<span class="date"><?php the_time('F d, Y'); ?></span>
    							<?php if(get_option('pyre_categories') == 'On'): ?>
    							<span class="category"><?php the_category(', '); ?></span>
    							<?php endif; ?>
    						</div>
    
    					</div>
    
    					<div id="post">
    
    						<?php if(has_post_thumbnail() && get_option('pyre_posts_featured') == 'On'): ?>
    						<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'featured-image'); ?>
    						<img src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>" class="featured-image" width="600" />
    						<?php endif; ?>
    
    						<div class="post-content">
    
    							<?php the_content('Read More →'); ?>
    
    							<div class="clear"></div>
    
    						</div>
    
    						<?php if(get_option('pyre_tags') == 'On'): ?>
    						<div class="post-tags">
    							<?php the_tags('', ''); ?>
    						</div>
    						<?php endif; ?>
    
    					</div>
    
    					<?php if(
    						get_option('pyre_twitter') == 'On' ||
    						get_option('pyre_facebook') == 'On' ||
    						get_option('pyre_digg') == 'On' ||
    						get_option('pyre_stumbleupon') == 'On' ||
    						get_option('pyre_reddit') == 'On' ||
    						get_option('pyre_tumblr') == 'On' ||
    						get_option('pyre_email') == 'On' ||
    						get_option('pyre_google') == 'On'
    					): ?>
    					<div class='post-share'>
    						<?php if(get_option('pyre_twitter') == 'On'): ?>
    						<div class='twitter-share share-widget'>
    							<a href="http://twitter.com/share" class="twitter-share-button" data-text='<?php the_title(); ?>' data-url='<?php the_permalink(); ?>' data-count="vertical">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
    						</div>
    						<?php endif; ?>
    						<?php if(get_option('pyre_facebook') == 'On'): ?>
    						<div class='facebook-share share-widget'>
    							<iframe src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&send=false&layout=box_count&width=46&show_faces=true&action=like&colorscheme=light&font=arial&height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:46px; height:65px;" allowTransparency="true"></iframe>
    						</div>
    						<?php endif; ?>
    						<?php if(get_option('pyre_digg') == 'On'): ?>
    						<div class='digg-share share-widget'>
    							<script type="text/javascript">
    							(function() {
    							var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
    							s.type = 'text/javascript';
    							s.async = true;
    							s.src = 'http://widgets.digg.com/buttons.js';
    							s1.parentNode.insertBefore(s, s1);
    							})();
    							</script>
    							<a class="DiggThisButton DiggMedium" href="http://digg.com/submit?url=<?php echo urlencode(get_permalink($post->ID)); ?>&title=<?php echo urlencode(get_the_title()); ?>"></a>
    						</div>
    						<?php endif; ?>
    						<?php if(get_option('pyre_stumbleupon') == 'On'): ?>
    						<div class='stumbleupon-share share-widget'>
    							<script src="http://www.stumbleupon.com/hostedbadge.php?s=5&r=<?php the_permalink(); ?>"></script>
    						</div>
    						<?php endif; ?>
    						<?php if(get_option('pyre_reddit') == 'On'): ?>
    						<div class='reddit-share share-widget'>
    							<script type="text/javascript">reddit_url='<?php the_permalink(); ?>'</script>
    							<script type="text/javascript">reddit_title='<?php the_title(); ?>'</script>
    							<script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script>
    						</div>
    						<?php endif; ?>
    						<?php if(get_option('pyre_tumblr') == 'On'): ?>
    						<div class='tumblr-share share-widget'>
    							<a href="http://www.tumblr.com/share" title="Share on Tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; width:62px; height:20px; background:url('http://platform.tumblr.com/v1/share_2.png') top left no-repeat transparent;">Share on Tumblr</a>
    						</div>
    						<?php endif; ?>
    						<?php if(get_option('pyre_email') == 'On'): ?>
    						<div class='email-share share-widget'>
    							<a href="mailto:?subject=<?php the_title(); ?>&body=<?php the_permalink(); ?>"><img src='<?php bloginfo('template_url'); ?>/images/email-share.png' alt='Email Share' /></a>
    						</div>
    						<?php endif; ?>
    						<?php if(get_option('pyre_google') == 'On'): ?>
    						<div class='google-share share-widget'>
    							<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
    							<g:plusone size="tall" href="<?php the_permalink(); ?>"></g:plusone>
    						</div>
    						<?php endif; ?>
    					</div>
    					<?php endif; ?>
    
    				</div>
    
    				<?php endwhile; ?>
    			<?php else: ?>
    			<div id="items-wrapper">
    
    				<?php $count = 1; ?>
    				<?php while(have_posts()): the_post(); ?>
    				<?php if($count == 3): $count = 1; endif; if($count == 2): $class = 'last'; else: $class = ''; endif; ?>
    				<div class="item <?php echo $class; ?>">
    
    					<?php if(has_post_thumbnail()): ?>
    					<div class="item-thumb">
    						<?php
    						if(has_post_format('video') || has_post_format('audio') || has_post_format('gallery')) {
    							$icon = '<span class="thumb-icon ' . get_post_format($post->ID) . '"></span>';
    						} else {
    							$icon = '';
    						}
    						echo $icon;
    						?>
    						<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail('archive-image'); ?></a>
    						<span class="comments"><?php comments_popup_link('0', '1', '%'); ?></span>
    						<?php if(get_post_meta($post->ID, 'pyre_overall_score', true)): ?>
    						<span class="item-review"><img src="<?php echo get_template_directory_uri(); ?>/images/stars/<?php echo get_post_meta($post->ID, 'pyre_overall_score', true); ?>.png" alt="<?php the_title(); ?> Overall Score" /></span>
    						<?php endif; ?>
    					</div>
    					<?php endif; ?>
    
    					<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
    					<p><?php echo string_limit_words(get_the_excerpt(), 25); ?></p>
    
    					<div class="item-meta">
    						<span class="date"><?php the_time('F d, Y'); ?></span>
    						<span class="category"><?php the_category(', '); ?></span>
    					</div>
    
    				</div>
    				<?php $count++; endwhile; ?>
    
    			</div>
    			<?php endif; ?>
    
    			<?php kriesi_pagination($pages = '', $range = 2); ?>
    
    		</div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Thank you!

    [Please use a pastebin for large blocks. This block of code is over 300 lines long]

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    tried replacing the_excerpt() with the_content()

    this only refers to the full WordPress functions - not any random occurence of the same letter sequence.
    http://codex.wordpress.org/Function_Reference/the_excerpt

    make a backup copy before editing.

    in archive.php and search.php;
    try and replace this line:

    <p><?php echo string_limit_words(get_the_excerpt(), 25); ?></p>

    with:

    <?php the_content(); ?>

    (might influence the formatting)

    the same line is in index.php, so if you want to change something there as well, you know what to do...

  3. ohheydoctor
    Member
    Posted 1 year ago #

    Thank you for your help. I'm one step closer! That did the job of showing the full post but now I need to format the way the post is actually displayed in these sections. If you see below in this category, the full post is shown but it's still wrapped in the tiny box instead of being shown like a normal post on the front page. Any insight on how to change this?

    http://ohheydoctor.com/category/music/electronic-2/

Topic Closed

This topic has been closed to new replies.

About this Topic