Wordpress Media Post

Discussion in 'Blogging' started by MarkNog, Jul 10, 2014.

  1. MarkNog

    MarkNog Registered Member

    Joined:
    Jan 14, 2013
    Messages:
    55
    Likes Received:
    6
    I have been working in wordpress trying to develop something that will post an image post every time you upload a photo, but I am having no success.

    Anyone ever do anything like this before?
     
  2. MarkNog

    MarkNog Registered Member

    Joined:
    Jan 14, 2013
    Messages:
    55
    Likes Received:
    6
    For anyone looking for a fix download auto post featured image which creates a new post with your media item selected as the featured image and then add this to the bottom of your functions.php file under appearance --> editor before the ?>

    Code:
    add_filter( 'afip_new_post_content', 'myprefix_change_afip_post_content', 10, 2 );function myprefix_change_afip_post_content( $post_content, $attachment_id ) {
     
        $my_uploaded_image = wp_get_attachment_image_src( $attachment_id );
        
        $post_content .= '<img src="' . $my_uploaded_image[0] . '">';
     
        return $post_content;
      }
    What this code does is inserts the featured image into your post so the post is not blank.