drawing URL from within LOOP
-
I really want to use this plugin but I can’t do the simplest thing.
What I want to do is just call out the URL to a single attachment to drop it into the href of a link for the user to download.
Actually, I’m not sure if that’s the right way to allow the user to download an attachment, but basically, right now I have no idea how to access the contents of the attachments array.
When I use the “exists” function, it returns the count of attachments. This seems fine.
When I use the “get” function, I get an array that houses the info about the attachment I loaded. Things seem to be working fine, I just can’t pull the contents from within the loop.Code:
// Check for attachments… or count them?? $attachments_yes_no = wpba_attachments_exist(array( 'post_id' => $post->ID, 'show_post_thumbnail' => true )); // Get attachments $about_attachments = wpba_get_attachments(array( 'post_id' => $post->ID, 'show_post_thumbnail' => true ));
Results of array prints:
Any attachments?
1
Attachments Array print:
Array ( [0] => WP_Post Object ( [ID] => 113 [post_author] => 1 [post_date] => 2014-01-11 06:24:33 [post_date_gmt] => 2014-01-11 06:24:33 [post_content] => This is a sample contract acting as a filler file. [post_title] => resume [post_excerpt] => sample contract [post_status] => inherit [comment_status] => open [ping_status] => open [post_password] => [post_name] => ams_pltarc_contract [to_ping] => [pinged] => [post_modified] => 2014-01-11 06:24:33 [post_modified_gmt] => 2014-01-11 06:24:33 [post_content_filtered] => [post_parent] => 109 [guid] => http://localhost/sachiko-beck/wp-content/uploads/2014/01/AMS_PltArc_contract.pdf [menu_order] => 1 [post_type] => attachment [post_mime_type] => application/pdf [comment_count] => 0 [filter] => raw ) [1] => WP_Post Object ( [ID] => 112 [post_author] => 1 [post_date] => 2014-01-11 03:04:52 [post_date_gmt] => 2014-01-11 03:04:52 [post_content] => [post_title] => Sachiko Beck Picture [post_excerpt] => [post_status] => inherit [comment_status] => open [ping_status] => open [post_password] => [post_name] => my-picture [to_ping] => [pinged] => [post_modified] => 2014-01-11 03:04:52 [post_modified_gmt] => 2014-01-11 03:04:52 [post_content_filtered] => [post_parent] => 109 [guid] => http://localhost/sachiko-beck/wp-content/uploads/2014/01/My-picture.jpg [menu_order] => 2 [post_type] => attachment [post_mime_type] => image/jpeg [comment_count] => 0 [filter] => raw ) )
- The topic ‘drawing URL from within LOOP’ is closed to new replies.