1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Wordpress: How to create featured image from visitor uploaded image

Discussion in 'PHP' started by indyonline, May 24, 2014.

  1. #1
    I'm using 'Memeone generator' plugin for wordpress to create a meme generator website.
    When a user uploads a meme the plugin creates a new blog post and inserts the image into the content area and creates a title for the post.
    SEMrush
    I was wondering how to take that same image and make it the featured image for that post.

    Below is the code they used to create the post, there might be more that goes with it but this was the main part I seen that I was editing for some other things.
        $new_wp_post= array(
          'post_title'     => $post_title,
          'post_content'   => '<div class="centerdiv"><img src="'. $meme->meme_url . $meme->meme_file_name.'.jpg' . '" /></div>',
          'post_status'    => $post_status,
          'post_author'    => $author
    Code (markup):
    thanks in advance,
    Rob
     
    indyonline, May 24, 2014 IP
    SEMrush
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    PoPSiCLe, May 24, 2014 IP
  3. indyonline

    indyonline Prominent Member

    Messages:
    4,626
    Likes Received:
    248
    Best Answers:
    2
    Trophy Points:
    335
    #3
    indyonline, May 25, 2014 IP
  4. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
  5. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #5
    Uhm, no, I didn't miss your point. I pointed you to an article that tells you which elements to add to your array to provide the array with the information you're looking to add - in this case, the featured image. Since I haven't messed around with this function in Wordpress, I didn't post a step-by-step, but I figured you'd be able to use the information in the article to edit the code you currently have to also include the featured image.
     
    PoPSiCLe, May 27, 2014 IP
  6. indyonline

    indyonline Prominent Member

    Messages:
    4,626
    Likes Received:
    248
    Best Answers:
    2
    Trophy Points:
    335
    #6
    Dude, that post tells how to do it inside the post while creating a new post and it shows how to set up your theme support. no where near what I was asking for and hardly any code on the page at all. soooo.....
     
    indyonline, May 27, 2014 IP
  7. indyonline

    indyonline Prominent Member

    Messages:
    4,626
    Likes Received:
    248
    Best Answers:
    2
    Trophy Points:
    335
    #7
    indyonline, May 27, 2014 IP