Title: [Plugin: Document Links Widget] Current Page Only?
Last modified: August 19, 2016

---

# [Plugin: Document Links Widget] Current Page Only?

 *  [cmurockstar](https://wordpress.org/support/users/cmurockstar/)
 * (@cmurockstar)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-document-links-widget-current-page-only/)
 * I love what your widget does, but it lists ALL pdfs, zips, etc for the entire
   site. Can you limit it to what is associated with the current page?
 * [http://wordpress.org/extend/plugins/document-links-widget/](http://wordpress.org/extend/plugins/document-links-widget/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [lorieransom](https://wordpress.org/support/users/lorieransom/)
 * (@lorieransom)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-document-links-widget-current-page-only/#post-1832077)
 * Hi there, sorry for the late reply. Currently the only way to limit the results
   is to manually select them in the [Document Links Admin Panel](http://ransomdesign.com/wordpress/wp-content/themes/ransomredesign/style/images/other/screenshot-1.png).
   Of course this limited list will be what is displayed on every page where the
   widget is used. Hope that helps.
 *  [yacroon](https://wordpress.org/support/users/yacroon/)
 * (@yacroon)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-document-links-widget-current-page-only/#post-1832134)
 * Not sure if you’re still looking for a solution.
 * Here’s what I did:
    1. Goto Plugins->Editor, look for the _Document Links Widget_ in the dropdown, 
       press select and make sure you’re editing _document-links-widget/rd-documentlinks-
       plugin.php_
    2. Look for the following code on line 175:
    3. `$result= $wpdb->get_results("SELECT ID, post_title, guid, post_mime_type, post_date
       FROM ".$wpdb->posts." WHERE post_type = 'attachment' ORDER BY post_date ".$sortOrder,
       ARRAY_N);`
    4. Replace with the following code:
    5. `global $post; $result= $wpdb->get_results("SELECT ID, post_title, guid, post_mime_type,
       post_date FROM ".$wpdb->posts." WHERE post_type = 'attachment' AND post_parent
       = ".$post->ID." ORDER BY post_date ".$sortOrder, ARRAY_N);`
    6. Now, when you want to associate a document to a certain page/post, just _attach_
       it in Media->Library, after you have uploaded it

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Document Links Widget] Current Page Only?’ is closed to new 
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/document-links-widget.svg)
 * [Document Links Widget](https://wordpress.org/plugins/document-links-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/document-links-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/document-links-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/document-links-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/document-links-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/document-links-widget/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [yacroon](https://wordpress.org/support/users/yacroon/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-document-links-widget-current-page-only/#post-1832134)
 * Status: not resolved