Title: User Submitted Posts Plugin
Last modified: August 20, 2016

---

# User Submitted Posts Plugin

 *  Resolved [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/)
 * Hello Im using the User Submitted Posts plugin to all users to post to the front
   page.
 * I use the code below in my content.php to get the pictures to appear too. Its
   all find when the users submit a photo.
 * Problem is when the users don’t add a photo, there is a dead link that appears.(
   you can see this happening here: [http://www.breakuppedia.com](http://www.breakuppedia.com))
   Do help me if you can.
 * Thank you so much!
 * <?php global $wpdb;
    $query = “SELECT `ID`, `guid` FROM `$wpdb->posts` WHERE `
   post_type` = ‘attachment’ AND `post_parent` = ‘{$post->ID}'”; $adimages = $wpdb-
   >get_results($wpdb->prepare($query), OBJECT); // To display the first image..?
   >
 * <img style=”float: left; height: 380px;border: 2px solid #464646;” src=”<?php
   if(is_public_submission()){echo $adimages[0]->guid;} ?>” />

Viewing 15 replies - 16 through 30 (of 40 total)

[←](https://wordpress.org/support/topic/user-submitted-posts-plugin/?output_format=md)
[1](https://wordpress.org/support/topic/user-submitted-posts-plugin/?output_format=md)
2 [3](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/3/?output_format=md)

 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144541)
 * If all else fails, consider using default code in your template content area 
   that aligns the images how you want. Seems a [gallery] could do it.
 * But, the template you use for that would render all post images as galleries 
   automatically, so you would only use that template for user submitted posts.
 *  Thread Starter [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144543)
 * Is it possible to use the default code.
 * And then add an additional code that will null the default code if there are 
   no attachments?
 * Sorry if this is a dumb statement. Im really new at this 🙂
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144544)
 * that’s what I’ve been playing with, but with no luck. i just don’t know how to
   tell wp to show an image, only if one exists. I’ve done it before but the context
   was different. I’m not great with this either. I help out partly to learn.
 *     ```
       <?php echo do_shortcode('[gallery]'); ?>
       ```
   
 * you could try that in your content area, instead of the code you are using
 *  Thread Starter [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144545)
 * Damn!
    It’s working! I think. but its kinda turned all the images into thumbnails.
 * Should I just add:
 *     ```
       <img style="float: left; height: 380px;border: 2px solid #464646;" />
       ```
   
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144546)
 * hey wait, in the last code you posted you don’t have
 *     ```
       <?php } }?>
       ```
   
 * instead you have
 *     ```
       <?php } ?>
       ```
   
 * fix it and try again.
 * or keep working with the gallery code. the choice is yours
 *  Thread Starter [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144547)
 * Thanks for helping anyways deepbevel!
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144548)
 * If you stay with the gallery method you can change the thumbnail size in image
   settings.
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144549)
 * also, [http://codex.wordpress.org/Gallery_Shortcode](http://codex.wordpress.org/Gallery_Shortcode)
 *  Thread Starter [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144550)
 * You mean like this?
 * `<?php echo do_shortcode('[gallery]'); }}?>`
 * The site went blank again, with only the header left
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144552)
 * no, I was talkiing about the original code,
 *     ```
       <?php global $wpdb;
            $query = "SELECT 'ID', 'guid' FROM '$wpdb->posts' WHERE 'post_type' = 'attachment' AND post_parent = '{$post->ID}'";
   
       if ($attachments) {
       if (post_parent = '{$post->ID}'){
        $adimages = $wpdb->get_results($wpdb->prepare($query), OBJECT);
        // To display the first image.. ?>
   
       <img style="float: left; height: 380px;border: 2px solid #464646;" src="<?php if(is_public_submission()){echo $adimages[0]->guid;} ?>" />
       <?php }
       ?>
       ```
   
 * if you still want to go that route.
 *  Thread Starter [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144553)
 * Damn!
    u’re good!!
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144554)
 * change
    <?php }?> to <?php }}?>
 *  Thread Starter [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144556)
 * This is currently working for me
 * `<?php echo do_shortcode('[gallery size= large]'); ?>`
 * but just for us to learn. I’ll try the old one with your fixes.
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144557)
 * I’m lucky, sometimes.
 *  Thread Starter [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/#post-3144558)
 * nope. the old one didn’t work with the }}!

Viewing 15 replies - 16 through 30 (of 40 total)

[←](https://wordpress.org/support/topic/user-submitted-posts-plugin/?output_format=md)
[1](https://wordpress.org/support/topic/user-submitted-posts-plugin/?output_format=md)
2 [3](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/3/?output_format=md)

The topic ‘User Submitted Posts Plugin’ is closed to new replies.

## Tags

 * [Coding](https://wordpress.org/support/topic-tag/coding/)
 * [Pictures](https://wordpress.org/support/topic-tag/pictures/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 40 replies
 * 2 participants
 * Last reply from: [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/3/#post-3144579)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
