Wordpress Plugin Needed - Recent Post (With Single Image)

Discussion in 'Programming' started by LindseyInteractive, Sep 18, 2014.

  1. #1
    Hello Guys,

    We are creating a new sites much like (cnn.com or foxnews.com) and we are looking for a plugin that will post articles from a specific category and have a SINGLE thumbnail/image for it. All the ones we are finding now have individual thumbnails for all of the different post, that is nto what we are needign.

    We need a single plugin that is going to post the images from the category with a single thumbnail, like you see on those news sites.

    Please anyone can help us and point us in the right direction of a plugin taht does this. There is one that came with our theme, but it does Latest Post and doesn't allow you to filter it by any category or anything.
     
    LindseyInteractive, Sep 18, 2014 IP
  2. Anveto

    Anveto Well-Known Member

    Messages:
    697
    Likes Received:
    40
    Best Answers:
    19
    Trophy Points:
    195
    #2
    When you use the word "post" it is hard to understand exactly what you mean. You say you don't need a plugin that has individual thumbnails for each post but you want a plugin which posts images from your different categories with a single image for each post? This sounds like the same thing to me but perhaps you mean a single image per category, otherwise please explain.

    I don't think a plugin is going to solve your issue, it sounds more like a theme problem. You could either find someone to modify the existing theme in the buy/sell section or find a theme that meets your requirements at a site like http://themeforest.net/category/wordpress/blog-magazine for example.

    Even giving the name of the plugin that came with your existing theme might help us understand the problem :)
     
    Anveto, Sep 18, 2014 IP
  3. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #3
    As Markus said, get your terminology straight. If I understand you correctly, you want to have multiple posts or content linked on a page, with one thumbnail? Or are you asking for something else? This would be pretty simple to do with CSS or javascript (just hide subsequent images), but that might not cater for your needs.
     
    PoPSiCLe, Sep 20, 2014 IP
  4. YoGem

    YoGem Active Member

    Messages:
    676
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    90
    #4
    It's my understanding you want to show a small excerpt of an article with just one image, the problem is that you don't want to show all images, you want just one also if there are multiple images per post. Well, coding is your friend.
    
      $string = "<p>Let's Assume this is your article content, now look we have an image here <img class=\"independent\" src=\"thisisanimage.jpg\">. And more content goes here and so on...</p>";
      $pattern = "/<img.*src=\"(.*)\".*>/siU";
      preg_match_all($pattern,$string,$results);
    
    Code (markup):
    Now, assuming that the code works (it does), you will have $results like this:
    
    Array
    (
        [0] => Array
            (
                [0] => <img class='indipendent' src="thisisanimage.jpg">
            )
        [1] => Array
            (
                [0] => thisisanimage.jpg
            )
    )
    
    Code (markup):
    ... and you'll need the first element of the second key aka $results[1][0] - Here you have your image!
    Then, strip_tags($string) and you'll get the content without html tags and then you can substr a string, let's say 200 chars like this:
    
      $excerpt = substr($stripped,0,200)."...";
    
    Code (markup):
    Then you echo the content inside a div, assuming you want the image maximum 75px wide:
    echo "<div id='excerpt'><img src='{$results[1][0]}' style='width:75px'><br><strong><a href='$link' title='$title'>$title</a></strong><br>$excerpt<hr></div>";
    Code (markup):
    Imagination is the key... and a capable programmer :p (sorry, not me.. too busy, I am here only to help with ideas)
     
    YoGem, Sep 22, 2014 IP