1

So I have implemented the functionality where anyone can upload certain types of files with a title and description. I am having trouble with the idea displaying them as posts or list in the a certain page. I am not sure how should I approach to make this possible.

Before posting here, I have searched other communities and off course tried google but still no hope. I know this is not a stackoverflow type question but I had to post this hoping the experts here can help me get on a track.

Basically it is a form where three fields are shown one being the title and others are for uploading a file and a text area for description. What I want is to make it a single custom post every time someone fill the form. In the backend, they can be shown as posts where admin can edit or delete just like typical wordpress posts. I hope I have explained this well enough.

Thanks and any link or resources are appreciated.

1
  • 1
    How are you storing and uploading these files? Are you referring to attachments in the media library? Without seeing code or technical details it's not possible to answer this question without relying on pure speculation
    – Tom J Nowell
    Aug 15 '14 at 14:15
1

If I am understanding the question correctly, you should be able to do a query for the media by user id. Something like the follow (untested) code:

//only do this if there is a user logged in
if( is_user_logged_in() ) {

    //get the currenly logged in user
    $user_ID = get_current_user_id();

    $upload_args = array(
        'post_type' => 'attachment',
        'author' => $user_ID
    );

    $uploads = new WP_Query( $upload_args );
}else{
    //what to do if there is no user logged in.
}

Hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.