WordPress.org

Ready to get started?Download WordPress

Forums

Remove the first line of content from posts (7 posts)

  1. wpmhweb
    Member
    Posted 2 years ago #

    Hello everyone!

    This is the situation, I used to add an image to my posts right into the content, then I figured that I can used featured images. To not repeat the images in a post I found a code that it will scan for the first image and then ignore it from the post. but the problem is that every time I create a new post I am forced to add a first image to the post. I am looking for a piece of code that I can use that it will go post by post, scan for the first image and delete from the post. There is anyway way to do this? Any help will be appreciated!

    Thanks,

  2. Floyd3
    Member
    Posted 2 years ago #

    I also have this question.

    I have over 500 posts, and need to delete the first line of each of them. Any way to do this without manually going in and editing them one by one?

  3. wpmhweb
    Member
    Posted 2 years ago #

    I thought I was the only one! Let's hope somebody help us out!

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    Is it exactly the same line in all of the posts?

  5. wpmhweb
    Member
    Posted 2 years ago #

    I am 99.9% sure it is. This is what it looks like:
    <p><a href="link-here"><img class="class" title="Title" src="link-here" alt="alt" width="684" height="250" /></a></p>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button.]

    I think it will be more accurate to say that I need to scan for the first image that it is in post and just get it out of there.

    Thanks,

  6. Floyd3
    Member
    Posted 2 years ago #

    My question is slightly different - it's not the same line in all of the posts.

    You can look at this page for example: http://www.pinkfloydtabs.com/echoes-guitar-tab

    I want to delete the "Echoes - Pink Floyd" part at the beginning of the post, because I am going to do a stylized replacement for that with the usage of this: <h5><?php the_title(); ?></h5>

    So all of the posts have the "Song Title - Pink Floyd" just as text at the very beginning of each tab/post. But the "Song Title" part is different for each.

  7. esmi
    Forum Moderator
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic