Forums

How can I hide first image from the post content (2 posts)

  1. abufarhan
    Member
    Posted 2 years ago #

    I have been looking around for modify my theme, actually I want to show Image and excerpt from index.php(home). Image that I'll use is image from the post not attachment , because I always use live writer to post my article. In windows live write i don't have to make image only copy and paste from any source, and Windows live writer automatic put and upload my image.
    I found this useful hack http://wordpress.org/support/topic/246893?replies=3 to show first image from the post and resize by thimthumb, I already make this one. the problem is in single.php I want to show image and excerpt to my single.php but I don't want to repeat first image at the content, Because I'll put image and excerpt at the top of my content

  2. sklundy
    Member
    Posted 2 years ago #

    Simply add a number as the fourth parameter in preg_replace().

    For example, I've limited the following code (from the link you provided) to removing replacing ONCE:

    $first_img = str_replace('http://yourwebsite.com', '', $first_img,1 );

    You are dealing with the "limit" parameter.

    See more here:

Topic Closed

This topic has been closed to new replies.

About this Topic