Title: rogue descriptions
Last modified: August 22, 2016

---

# rogue descriptions

 *  Resolved [karidemi](https://wordpress.org/support/users/karidemi/)
 * (@karidemi)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/rogue-descriptions/)
 * First off, let me just say how completely awesome this plugin and its developers
   are for being so helpful and responsive to requests.
 * But, of course, now I have a problem 🙂
 * I have successfully used the three new filters to manage the output of the plugin
   and everything is working as expected, except for the descriptions. They are 
   appearing outside of the HTML I am rendering (a table) and I don’t see a specific
   tag for rendering them the documentation. Is there a %desc% or something I should
   be using?
 * Thanks again!
 * [https://wordpress.org/plugins/document-gallery/](https://wordpress.org/plugins/document-gallery/)

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

 *  Plugin Author [Dan Rossiter](https://wordpress.org/support/users/danrossiter/)
 * (@danrossiter)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/rogue-descriptions/#post-5347984)
 * Rats! You’re absolutely right. I did not think about that.
 * I’ll work on getting a patch out to address that issue either late today or tomorrow.
 * Thanks for pointing that out!
    -Dan
 *  Plugin Author [Dan Rossiter](https://wordpress.org/support/users/danrossiter/)
 * (@danrossiter)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/rogue-descriptions/#post-5348019)
 * Hi karidemi,
 * I don’t have time to test this solution this minute, but if you you want to try
   replacing `toString()` in `inc/class-document.php` with the following, I *think*
   it will give you what you want.
 * -Dan
 *     ```
       public function __toString() {
             static $find = null;
             if (is_null($find)) {
                $find = array("%link%", "%img%", "%title_attribute%", "%title%", "%description%");
             }
   
             $thumb = $this->gallery->useFancyThumbs()
                 ? DG_Thumber::getThumbnail($this->ID)
                 : DG_Thumber::getDefaultThumbnail($this->ID);
   
             $repl = array($this->link, $thumb, $this->title_attribute, $this->title, $this->description);
   
             $doc_icon = apply_filters(
                'dg_icon_template',
                '   <div class="document-icon">' . PHP_EOL .
                '      <a href="%link%"><img src="%img%" title="%title_attribute%" alt="%title_attribute%" /><br>%title%</a>' . PHP_EOL .
                ($this->gallery->useDescriptions() ? "   <p>%description%</p>" . PHP_EOL : '') .
                '   </div>' . PHP_EOL,
                $this->gallery->useDescriptions(),
                $this->ID);
   
             $core = str_replace($find, $repl, $doc_icon);
   
             // users may filter icon here
             return apply_filters('dg_doc_icon', $core, $this->ID, $this->gallery->useDescriptions());
          }
       ```
   
 *  Thread Starter [karidemi](https://wordpress.org/support/users/karidemi/)
 * (@karidemi)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/rogue-descriptions/#post-5348130)
 * Worked like a charm. Thanks!
 *  Thread Starter [karidemi](https://wordpress.org/support/users/karidemi/)
 * (@karidemi)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/rogue-descriptions/#post-5348132)
 * Ok, one last thing… I hope!
 * Now, I am trying to have the galleries with descriptions render differently than
   those without. To do that I’m passing in an argument to my filter function : 
   dg_gallery_template_func($desc) and then using an if/else to see if $desc is 
   true or not. However, it appears to always return true, regardless of if I actually
   have descriptions turned on. \
 * I did a test and when I return the value of $desc, it returns the whole gallery
   instead of the bool value, like I would have assumed.
 * Am I doing this correctly?
 * -Karissa
 *  Plugin Author [Dan Rossiter](https://wordpress.org/support/users/danrossiter/)
 * (@danrossiter)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/rogue-descriptions/#post-5348142)
 * Glad that tweak for the descriptions worked! I’ll have it in the next official
   release sometime soon 🙂
 * With the filtering function, you’ll want to accept two parameters. The first 
   value will be, as you discovered, the gallery as it is generated (the value being
   filtered). The second parameter will receive the boolean you are looking for.
 * Let me know if that works for you!
    -Dan
 *  Plugin Author [Dan Rossiter](https://wordpress.org/support/users/danrossiter/)
 * (@danrossiter)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/rogue-descriptions/#post-5348156)
 * Sorry, I lied about 2 parameters. It’s actually 3. The first is the default icon
   template, the second is the attachment ID, and the third is the boolean value
   you’re looking for.
 * For the other two filters, it is just the 3.
 * -Dan
 *  Thread Starter [karidemi](https://wordpress.org/support/users/karidemi/)
 * (@karidemi)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/rogue-descriptions/#post-5348167)
 * Thanks, Dan. With your help I was able to get this working to my satisfaction!
 * -Karissa
 *  Plugin Author [Dan Rossiter](https://wordpress.org/support/users/danrossiter/)
 * (@danrossiter)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/rogue-descriptions/#post-5348175)
 * Fantastic! So glad to hear it 🙂

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

The topic ‘rogue descriptions’ is closed to new replies.

 * ![](https://ps.w.org/document-gallery/assets/icon.svg?rev=983329)
 * [Document Gallery](https://wordpress.org/plugins/document-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/document-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/document-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/document-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/document-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/document-gallery/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [Dan Rossiter](https://wordpress.org/support/users/danrossiter/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/rogue-descriptions/#post-5348175)
 * Status: resolved