Link to home
Start Free TrialLog in
Avatar of suply
suply

asked on

Wordpress First Post Full Rest Excerpt

Hello, I want to have only latest post show un full and rest in excerpt. I have attached the code of the file that shows posts in home page.

I've tried to apply codes from the web without success.

Note: currently it is showing all posts in equal format. I only need the first one in full and the rest just an extract.

Thanks in advanced.
code.txt
Avatar of jrm213jrm213
jrm213jrm213
Flag of United States of America image

Try replacing that code with something like this
 <div class="singlePost">
                    <?php 
$postCount = 0;
if(have_posts()) : while(have_posts()) : the_post('');
$postCount++;
?>
                   
                    	<div class="article">
                        	<div class="articleDetails">
                            	<div class="articleTitle">
                                     <a href="<?php the_permalink();?>"><h1><?php the_title(); ?></h1></a>
                                </div><!--End articleTitle-->
                                <div class="articleMeta">
                                   <ul>
                                        <li class="postAuthor"><?php the_author(); ?></li>
                                        <li class="postDate"><?php the_time('d M Y'); ?></li>
                                        <li class="postCat"><?php the_category(', ') ?></li>
                                        <li class="postComments"><?php comments_popup_link(__('<span class="icon"></span> 0 Comments', 'lioit'), __('<span class="icon"></span> 1 Comment', 'lioit'), __('<span class="icon"></span> % Comments', 'lioit')); ?></li>
                                       
                                    </ul><!--End Post Meta-->
                                    
                                </div><!--End articleMeta-->
                            </div><!--End Article Details-->
                            <div class="articleContent">
                            	<div class="articlePostThumb">
                                     <?php $img = catch_that_image($post->ID); ?>
                                    <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
                                    <img src="<?php echo Lioit_URI; ?>/scripts/timthumb.php?src=<?php echo $img ?>&amp;w=200&amp;h=150&amp;zc=1" alt="<?php the_title(); ?>" />
                                    </a>
                                </div><!--End LatestPostThumb-->
                            	<p><?php 
if($postCount > 1){
                  the_excerpt_max_charlength(''); 
                  echo(" ...");
}
else
{
    the_content();
}

?></p>
                            </div><!--End ArticleContent-->
                            <div class="articleBtm">
                            	<?php require Lioit_TM . '/share.php';?>
                                <div class="articleReadMore">
                                	<a href="<?php the_permalink();?>"><?php _e('Read More' , 'lioit' ) ?></a>
                                </div><!--End More-->
                            </div><!--End Article Bottom-->
                        </div><!--End article-->
                        <?php endwhile; ?>
						<?php  else:  ?>
                        <?php  endif; ?>
                        <?php lio_pagination(); ?>
                         </div>

Open in new window


so basically outside "The Loop" we set the postCount to 0; Inside the loop for each iteration the postCount variable is incremented and that value is checked before displaying the post excerpt or content. If it is <= 1 then display the full post content, if it is > 1 then display the excerpt content.
Avatar of suply
suply

ASKER

Hello jrm213jrm213, thanks. I used it and it's almost perfect. Please see the attached image. As you can see, there are two images. I'd need only the big one.

Also, is it possible to remove the read more button only for the lastest post?

Regards.
JC.
img.PNG
Avatar of suply

ASKER

I managed to delete the thumb image left side. Latest full post is OK but I'd like to have other post to show their big image

Is this possible?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of jrm213jrm213
jrm213jrm213
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of suply

ASKER

jrm213jrm213, we're almost done thanks once again. Read more is gone, latest post big image is showing, I managed to remove the thumb, but for the rest of the posts is it possible to have and post image as the one that's currently as latest post?

I'm attaching a screen shot
img.PNG
I am unfamiliar with the function "catch_that_image" that is being called to retrieve the post image. I am guessing it comes from a plugin or is built into your custom theme.

Nothing in the code is excluding the "non-first" posts from having an image displayed so it must be something in that function. Could you post the code that you are currently using that you modified to not display the thumbnail?

If you have a featured image set for the page you can use the function the_post_thumbnail to display it

http://codex.wordpress.org/Function_Reference/the_post_thumbnail
Avatar of suply

ASKER

Thanks!
Avatar of suply

ASKER

jrm213jrm213

Is it possible that when you click page 2 the first post doesn't show full?