• Plugin Author Tareq Hasan

    (@tareq1988)


    Uploaded images by WP User Frontend plugin are saved as an attachment to the post. They can be found in the “Media” section of /wp-admin.

    Currently there is no way to show the attachment images to the post, as long this feature doesn’t come by default, please use this code in your themes single.php to show the attached images:

    <?php
    $args = array(
        'post_type' => 'attachment',
        'numberposts' => null,
        'post_status' => null,
        'post_parent' => $post->ID
    );
    $attachments = get_posts($args);
    if ($attachments) {
        foreach ($attachments as $attachment) {
            echo wp_get_attachment_image($attachment->ID, 'medium');
        }
    }
    ?>

    https://www.ads-software.com/extend/plugins/wp-user-frontend/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thank you for the tip, it worked. Can you tell me how I can get rid of the black border though?

    Thanks for this code… it works but…It’s global for all posts. Any way to restrict it to specific categories?

    Also, I was looking at gravity forms and they use some sort of merge fields option to actually put the images in the Post itself. That would really make this plugin great for me.

    Hi,
    I am using Sceleton theme and tried this code with no success. All I got was displayed image from “attach” option of wpuf not “upload image”, however, this wasn’t very helpful because there is option in plugin settings to enable view of attached files which does the same thing.

    Is there any update on this matter because I really need this option and looks like I’m kinda stuck here ??

    Thanks

    Hi Tareq Hasan

    i had a problem with front end posting , feature image is not get uploaded
    i follow as per the procedure as u given

    thank u

    Images can be added directly to. posts if rich text editor is enabled but there are some issues. The image is not only associated with the post but the add post page as well. So any image you upload will appear below the add post form on the page (I’m going to start a separate thread about this.
    I used the user role editor plugin to allow contributors permission to add media but not edit or delete it.

    Thanks for this info! Also, in reply to an above question, you could restrict it based on category using the WP conditional:

    <?php
    if ( in_category( ‘your_category’ )) {
    YOUR CODE
    }
    ?>

    So, for example:

    <?php
    if ( in_category( 'your_category' )) {
        $args = array(
            'post_type' => 'attachment',
            'numberposts' => null,
            'post_status' => null,
            'post_parent' => $post->ID
        );
        $attachments = get_posts($args);
        if ($attachments) {
            foreach ($attachments as $attachment) {
                echo wp_get_attachment_image($attachment->ID, 'medium');
            }
        }
    }
    ?>

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: WP User Frontend] Showing uploaded images’ is closed to new replies.