WordPress.org

Support

Support » How-To and Troubleshooting » Crop the_content() after 2nd

Crop the_content() after 2nd

  • 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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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?

    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.

    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.

    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>

    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>

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Crop the_content() after 2nd’ is closed to new replies.