I'm trying to create custom pages for clients. Specific documents would be uploaded to protected folders, and the titles and URLs would be listed on these custom pages. There is no crossover of material. Clients should not see each other's material, and I have the pages and upload folders protected.
I have a bad system set up right now for how the document names are added to these client pages. It requires too many steps.
In trying to streamline it, I thought about using custom post types for each client and then attaching one document per post and getting the title of the custom post and the URL of the attachment in my loop. Whoever was inputting the document would not have to get the URL manually and move it to the client page, which is what we're doing now. My plan worked perfectly in my mind. It's not going so well on the code side. Here is what I have:
$args = array( 'numberposts' => 3, 'post_type' => Clientone);
$myposts = get_posts( $args );foreach( $myposts as $post ) : setup_postdata($post); ?>
<h2><a href="document URL would go here" ><?php the_title(); ?></a></h2>`
I've tried many variations of echo wp_get_attachment_url for the attachment URL, and I'm not coming up with the right code to generate the URL. Has anyone else run into this?