0

I have been using WordPress for my blog. Since for few posts the content description shows with title. So the content duplicates.

Ex:

My post has title: xxxxxxxx and description: yyyyyy

But its displaying xxxxxxxxyyyyyy. To display the content I have used the_excerpt().

This is happening for few post only.

Please help me to fix.

3
  • Please show us the code you use.
    – Max Yudin
    Commented Oct 9, 2017 at 13:11
  • This is the part of displaying description<div class="post_description clearfix"> <?php // Show Content/Excerpt if(boc_blog_full_post_content()){ the_content(); }else { the_excerpt(); } ?> </div>
    – Jagadeesh
    Commented Oct 10, 2017 at 7:07
  • You should edit your question with this information.
    – Max Yudin
    Commented Oct 10, 2017 at 8:14

1 Answer 1

0

That's bizarre. The problem may come from broken html/css with different title or desc lengths. Have you checked the admin to make sure these posts actually don't have description in their title? Here is a simple example of showing the title and excerpt in a posts loop.

<?php while ( have_posts() ) : the_post(); ?>
    <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> 
    <div><?php the_excerpt(); ?></div>
<?php endwhile; <?
1
  • the_excerpt() returns the data which has title and description together.
    – Jagadeesh
    Commented Oct 10, 2017 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.