WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Desperately trying to use the_excerpt function on a page (9 posts)

  1. smm18951
    Member
    Posted 5 years ago #

    Hi guys,

    I went to my wordpress admin panel and created a page with this loop in it:

    <br />
    <?php
    global $post;
    $myposts = get_posts('numberposts=100&order=DESC&orderby=post_date&category=56');
    foreach($myposts as $post) :
    setup_postdata($post);
    ?>
    <a href="<?php the_permalink(); ?>"><?php the_title();
                                                                echo "<br />";
    
     ?></a>
    <p><?php the_excerpt(); ?></p><br />
    <?php endforeach; ?>

    The loop displays the_content in stead of the_excerpt. I have read over template hierarchy 2-3 times and I even created a new page template from scratch and no matter how I work things out, I can't get the_excerpt function to display the excerpt. It only displays the entire content of the post.

    I really need some honest help here, I have been playing with this for a couple of days now.

    Thanks guys

  2. Samuel B
    moderator
    Posted 5 years ago #

  3. smm18951
    Member
    Posted 5 years ago #

    No that won't display anything. Thanks though. I am wondering if those functions(the_excerpt & wp_trim_excerpt) are missing from my theme or my installation. Can someone tell me where I should be able to find them?

    thanks

  4. MichaelH
    Member
    Posted 5 years ago #

    Change to the WordPress Default Theme, edit wp-content/themes/default/index.php, and change this line:

    <?php the_content('Read the rest of this entry &raquo;'); ?>

    to

    <?php the_excerpt(''); ?>

    Then edit a Post and type something in the Excerpt field. Then visit the main page and you should just excerpts.

  5. smm18951
    Member
    Posted 5 years ago #

    Hi MichaelH...thank you for getting back to me. Are you saying that even though I am using a different theme, I should still adjust the default theme?

    thank you

  6. smm18951
    Member
    Posted 5 years ago #

    Hi Michael...I just tried it, and nothing happened. Everything went the same way as before. I guess that means that my problem has nothing to do with my theme. Do you think it might be possible for one of my plugins to be causing an error? Maybe its my post teaser plugin causing problems.
    Here is a list of my current plugins:

    Akismet
    All in One SEO Pack
    Bookmark Me
    Break Out Of Frames
    Contact Form 7
    Exec-PHP
    Google Analytics for WordPress
    Google XML Sitemaps
    Hotlink 2 Link
    Please Link 2 Me
    Post-Plugin Library
    Post Layout
    Post Teaser
    Redirection
    Similar Posts
    Subscribe To Comments
    Target Blank In Posts And Comments
    WordPress No Pagerank
    WP-EMail
    WP-PostRatings
    WP-PostViews
    WP-Print
    wp-Table

    Do you think any of them might cause this situation?

  7. MichaelH
    Member
    Posted 5 years ago #

    I'd guess Post Teaser, but if that's not it, might have do deactivate one-by-one to find the culprit.

  8. smm18951
    Member
    Posted 5 years ago #

    sure enough that was it. The post teaser plugin impedes the the_excerpt() function. I guess I should ask the author if he know a work around.

    Thanks MichaelH

  9. smm18951
    Member
    Posted 5 years ago #

    The problem came from the plugin post teaser. The Post Teaser plugin is an awesome plugin and the guy handling the updates and hosting for the site is Han and he is one helpful dude. Unfortunately, I have o uninstall Post Teaser and give Evermore a try. As it turns out Evermore works as a fix for my problem. The only thing I had to adjust on the Evermore plugin was to change the default settings from 1 to 2 paragraphs to be displayed.

    Everything is great now. Thanks to all who tried to help:>

Topic Closed

This topic has been closed to new replies.

About this Topic