WordPress.org

Ready to get started?Download WordPress

Forums

Crop the_content() after 2nd (7 posts)

  1. sincewelastspoke
    Member
    Posted 2 years ago #

    Is it possible to crop my content after the 2nd </p>?

    So the resulting HTML could be: <p>test1</p><p>test2</p>

    Many thanks for any help.

  2. Brad Markle
    Member
    Posted 2 years ago #

    Hi sincewelastspoke,

    I'm not sure if I completely understand your question.

    You are wanting the code to look like this, correct?
    <p>test1</p><p>test2</p>

    If so, what does it look like initially?

  3. sincewelastspoke
    Member
    Posted 2 years ago #

    Currently the text is:
    <p>test1</p><p>test2</p><p>test3</p><p>test4</p>

    I'd like to crop the outputted text to simply:
    <p>test1</p><p>test2</p>

    Hope this helps. Thank you.

  4. Brad Markle
    Member
    Posted 2 years ago #

    Hi sincewelastspoke,

    I hate to further delay this, but what you pasted appears to be the same to me. The only difference I see is that the first example includes test3 and test4.

    Are you trying to add a line break after test2?

    I'm a little lost still. Any additional information you can provide will be helpful.

  5. sincewelastspoke
    Member
    Posted 2 years ago #

    Hi,

    I have the code: <p>test1</p><p>test2</p><p>test3</p><p>test4</p> in my WordPress page.

    I'd like to output this in the Loop to just show:
    <p>test1</p><p>test2</p>

  6. Brad Markle
    Member
    Posted 2 years ago #

    Hi sincewelastspoke,

    Are you trying to use the readmore option within WordPress?

    More info can be found here:
    http://codex.wordpress.org/Customizing_the_Read_More

    It sounds like you just need to insert the more tag:
    <!--more-->

    ... like this

    <p>test1</p><p>test2</p>
    <!--more-->
    <p>test3</p><p>test4</p>
  7. sincewelastspoke
    Member
    Posted 2 years ago #

    Thank you. I will investigate this a bit more shortly.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.