WordPress.org

Ready to get started?Download WordPress

Forums

Excerpt is showing content instead (3 posts)

  1. vertexman
    Member
    Posted 1 year ago #

    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.

  2. vertexman
    Member
    Posted 1 year ago #

    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; ?>
  3. vertexman
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic