WordPress.org

Support

Support » How-To and Troubleshooting » Excerpt is showing content instead

Excerpt is showing content instead

  • vertexman
    Member

    @vertexman

    Hello,
    I have this problem. I display an excerpt of specific post in my sidebar. But when I open the full post (single.php), the excerpt in sidebar is showing whole content of post instead excerpt. I want to have the excerpt in sidebar static. I can not find any solution in google, I would be very thankful If you helped me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • vertexman
    Member

    @vertexman

    This is my code in sidebas:

    <?php query_posts('cat=6&showposts=1'); ?>
                            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                            <div class="meta-date"><?php the_date(); ?></div>
                                <?php
                                $myExcerpt = get_the_excerpt();
                                $tags = array("<p>", "</p>");
                                $myExcerpt = str_replace($tags, "", $myExcerpt);
                                echo '<p>'.$myExcerpt;
                                ?>
                                <a href="<?php the_permalink(); ?>">viac tu</a>
                            <?php endwhile; else: ?>
                                <p>Sorry, no posts matched your criteria.</p>
                            <?php endif; ?>
    vertexman
    Member

    @vertexman

    I find out that the post had no ‘post_excerpt’ in database and after I inserted it there manually, it works. So the problem is, why the post didn’t save his excerpt in database?

    P.S: sorry for my english

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Excerpt is showing content instead’ is closed to new replies.