ThemeShaper Forums » Thematic

Creating a short excerpt

(18 posts)
  • Started 5 years ago by waseem
  • Latest reply from Deirdre
  • This topic is not resolved


  1. Hey,
    How can I change the amount of words that show up for a post. I only want a short excerpt of the content rather than showing the whole post.

    Posted 5 years ago #
  2. Ohh I figured it out but I had to edit the index file of the thematic theme. Is there a way to do this from my functions file with out touching the index.php?

    Posted 5 years ago #
  3. Hey,

    could you please let me know what you changed in index.php.

    I'm currently working on Thematic 0.9 to make it more flexible.



    Posted 5 years ago #
  4. in the index file instead of using get_content(); I used get_the_excerpt(). This calls for the excerpt you typed when you published a post. If you dont have an excerpt I think wordpress fakes one by placing the first 55 words of the post.

    Posted 5 years ago #
  5. Yeah but it would be way cooler if you can do it through the functions file of the child theme. Not sure if that's possible. Maybe there is a way to filter it out or something.

    Posted 5 years ago #
  6. Read Justin's example. It's exactly what you're talking about.

    Posted 5 years ago #
  7. Does it work if we use other Plugins that have a content filter? A Code-View Plugin needs a

    <pre> tag at the beginning and the end of a Code display in a post. Whats happend if the_excerpt cut it between this two tags?

    Posted 5 years ago #
  8. Hey Anthrax,

    I checked some blogs regarding Syntax Highlighting yesterday .. The plugins using the 'pre' tag plus the GeSHi code were reported to be pretty robust against most of the excerpt tools. Unfortunately a lot of tools are doing a lot of things using filter functions. None of us can give you an general answer if a plugin would work in general.

    This was the major reason why I copied the functionality of excerpt and expert_rss into thematic functions to make it bullet-proof.



    Posted 5 years ago #
  9. No code changes needed here!

    Posted 5 years ago #
  10. The excerpt works fine, but how can i force the_exerpt to ignore image tags?
    To show you the Problem just take a look at my Blog and scoll down till "neues Ego in der XBox360 Welt!".

    [solved] ... with preg_replace

    Posted 5 years ago #
  11. I also trying to add excerpts to the home page of my blog, which uses the the Acamas template.

    Based on previous comments, I have done the following:

    Added Justin Tadlock's code to function.php:

    // Create a excerpt on the home page
    function my_excerpts($content = false) {

    // If is the home page, an archive, or search results
    if(is_front_page() || is_archive() || is_search()) :
    global $post;
    $content = $post->post_excerpt;

    // If an excerpt is set in the Optional Excerpt box
    if($content) :
    $content = apply_filters('the_excerpt', $content);

    // If no excerpt is set
    else :
    $content = $post->post_content;
    $excerpt_length = 55;
    $words = explode(' ', $content, $excerpt_length + 1);
    if(count($words) > $excerpt_length) :
    array_push($words, '...');
    $content = implode(' ', $words);
    $content = '<p>' . $content . '</p>';


    // Make sure to return the content
    return $content;

    In addition, in variant.css I have made following change to premit content to appear:

    /* .home .entry-content, */
    .home .entry-meta,
    .home .entry-utility {

    At this point, my site hasn't launched. That being the case, I did write an excerpt with the placeholder post to see if it would appear—it doesn't. It appears, however, in Archive and Categories.

    I comfortable working with PHP. As such, I look foward to any advise you all have.


    Posted 5 years ago #
  12. Hey,

    let me check this first with the Acamas theme .. I implemented a new filter which enables you to tell Thematic to use the full post, an excerpt or no post content.



    Posted 5 years ago #
  13. Hi,

    Ditto, I'd love your advice. I can overwrite the default thematic_content function if necessary so it doesn't force full posts on the home page but it sounds like you're already working on it.

    What I'd really like to do is use the Advanced Excerpt plugin (as suggested by Ian here: but it doesn't work on the site home page.


    Posted 5 years ago #
  14. Chris, thank you!! I just found the answer you'd already written here:

    And I was able to get excerpts working on the home page using:

    function childtheme_content($content) {
    if (is_home() || is_front_page()) {
    $content= 'excerpt';}
    return $content;
    add_filter('thematic_content', 'childtheme_content');

    Thanks again!

    Posted 5 years ago #
  15. Deirdre

    Hi everyone -

    I used the code by Justin Tadlock in function.php and was successful in displaying excerpts on the home page, which is exactly what I was looking for.

    The only thing I'm not sure how to do is create a link after the excerpt to the full post - like a "Read More..." link.

    Does anyone know how would I go about doing that?

    Thanks in advance!


    Posted 4 years ago #
  16. amygail

    Hey Deirdre
    This should do it

    Posted 4 years ago #
  17. Deirdre

    You rock, thanks!

    Posted 4 years ago #

RSS feed for this topic


You must log in to post.