• Resolved Steven West

    (@steven-west)


    Hello everyone,

    I’m currently making my personal blog, yet I’m getting stuck on what seems to be a pretty simple issue.

    My question is: I’ve created a post, with around five paragraphs, yet I don’t want to display all these paragraphs on the front page, I just want one paragraph for each article on the index page. How do I do this?

    If anyone has any idea on how to do this, I would be very grateful for your support and kindness.

    My current code is:

    <?php if ( is_archive() || is_search() ) : ?>
                        <?php the_excerpt(); ?>
                    <?php else : ?>
                        <?php the_content(); ?>
    
                    <?php endif; ?>

    Code is located in file: “Loop.php”

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • In the post, copy the first paragraph and paste it into the “excerpt” field. then it should show correctly.

    <?php if ( is_archive() || is_search() || is_home() ) : ?>
                        <?php the_excerpt(); ?>
                    <?php else : ?>
                        <?php the_content(); ?>
    
                    <?php endif; ?>
    Thread Starter Steven West

    (@steven-west)

    @klongdesigns: I don’t understand… I have a list of articles, I don’t want one paragraph snippet from one article on several different articles, that wouldn’t make sense having something completely irrelevant to the subject of the article.

    @emsi: Tried that snippet of code but didn’t achieve what I wanted.

    Thanks

    WordPress does not offer the functionality to extract one paragraph. Think about it. One paragraph can be 20 words or 100 words. That’s simply not practically programmable.

    Thread Starter Steven West

    (@steven-west)

    I beg to differ, judge for yourself.

    TorrentFreak Link

    TorrentFreak seems to pull this off quite well…

    Yes… and? That looks like the_excerpt() to me. Alternatively, use the more tag in your posts.

    Thread Starter Steven West

    (@steven-west)

    I find it funny, your attitude comes across as quite snotty and rude. All I was saying is that they managed to pull it off, so why can’t I…

    I shall keep trying to successfully accomplish this issue.

    Thanks for your help.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Display the first paragraph of article’ is closed to new replies.