• I’m trying to get excerpts to work in my theme using 3.0, but I can’t figure it out. In my template I’ve replaced
    <?php the_content(__(‘(more…)’)); ?>
    with
    <?php the_excerpt(); ?>
    but it isn’t working, my whole post including all images is still showing up. I’d like to add just an excerpt and a thumbnail size image rather than have the whole post show up. Any help? Here is my site:
    (http://thecrisisfilm.com/wordpress/blog/)

Viewing 15 replies - 1 through 15 (of 18 total)
  • You can place the <!–more–> tag at the point in your post where you want the excerpt to end.

    Or you can read this http://codex.wordpress.org/Customizing_the_Read_More

    Thread Starter mtx212s

    (@mtx212s)

    Yeah, but the <!–more–> tag still leaves the full image, I’m interested in using a thumbnail, or even no image at all.

    Go to the post in question, remove the image, click the “Add Image” icon, open the “Media Library”, and select the image you want to use, then check the radio button for the size image you want to use which will be (150 x 150 Thumbnail), and click “Insert into post”.

    Thread Starter mtx212s

    (@mtx212s)

    But I want the full size image for the single post, and a thumbnail for the excerpt. Won’t doing that make both the excerpt and single post contain a thumbnail?

    You’re probably using an image that is a thumbnail.

    Right click on the image in single post and view it’s properties to see how big it actually is, or just click on it to load it into a page.

    Thread Starter mtx212s

    (@mtx212s)

    Here’s an example of what I’d like to achieve: http://nicekicks.com/

    Thread Starter mtx212s

    (@mtx212s)

    Look on my page (first post, not this last one). My images are full size, when you select the image size that you want to insert, that’s the size it inserts it into the post. I want the post image to be full size, and my excerpts to be thumbnails.

    I see what you mean now.

    There doesn’t seem to be a way to set it in the WP editor, and I can’t find it in the singlepost.php.

    I guess we’ll have to write our own include. I’ll look up the function and get back to you.

    Thread Starter mtx212s

    (@mtx212s)

    Awesome, I appreciate it.

    Here’s is one way to do this, it’s kind of hackish, but it’ll get the job done. I’m sure there is a more efficient method, it’ll just take time to develop.

    First the actual Excerpt

    You’ll use the “Excerpt” edit box, just below your post edit box.

    Put an <img class="thumbnail" src="path to the image you want">

    You can go to the media library and select show to view the info for the image you want, then copy the url for the image from there, and past it into the src=” section of the image tag. Don’t use the insert image button at the top of the edit post box, it’ll only put it at the end of the actual post.

    Also you can put any HTML and text you want to use in the excerpt edit box, just like you would in the post edit box</p?

    In the style.css .thumbnail{float:left;width:yourwidth;height:yourheight;margin:20px;}

    In the index.php find the line that reads something like <?php the_content(‘Read More… ‘); ?> remove this line and replace it with
    <?php the_excerpt(); ?>

    This will force WP to use the information from the excerpt edit box if you put anything in it.

    If you don’t put anything in the excerpt edit box, then WP will use the set number of characters from your post(the default is 55) and it’ll strip any images and html from the post.

    This method requires you to manually set up each post this way. Only for the Excerpt edit box. The .thumbnail class, and the <?php the_excerpt(); ?> only need to be set up once.

    If you are using the built in WordPress thumbs then it is quite easy, make the thumbnail image div conditional, no image still show the excerpt, I had a look at your website and you might consider adding a margin top and right, this is a twenty ten example and works well.

    <div class="entry-content">
    	<?php /* if we have a thumbnail then show it */ ?>
    	<?php if(has_post_thumbnail()): ?>
    		<div class="cms-image" style="float: left; margin: 5px 5px 0 0;">
    		<a href="<?php the_permalink() ?>"> <?php the_post_thumbnail(); ?></a>
    		</div>
    	<?php endif; ?>
    	<?php the_excerpt(); ?>
    	<?php /* REMOVED the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); */ ?>
    </div><!-- .entry-content -->

    David

    Thread Starter mtx212s

    (@mtx212s)

    So I should enter this ^^^ where the
    <?php the_content(__(‘(more…)’)); ?> would be?

    Thread Starter mtx212s

    (@mtx212s)

    For a minute I tried using an ExcerptThumbnail plugin, but it didn’t let me customize the size of the thumbnail and float the content to the right. I’ll give this a try.

    There are four <div class=”entry-content”> in the twentyten loop.php, I use this code on three and four, I created a child theme and changed the set_post_thumbnail_size to one for my theme as well, so it will depend if your theme has thumbnail support.

    David

    Looking at your site you have taken down the images, in your theme in the style.css

    a img {
    	border: none;
    }

    Add:

    a img {
    	border: none;
             margin: 5px 5px 0 0;
    }

    To add WordPress thumbnail support is about three lines of code check Mark Jaquith:

    David

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Using Excerpts in 3.0’ is closed to new replies.