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
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());
}
Worked like a charm. Thanks!
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
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
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
Thanks, Dan. With your help I was able to get this working to my satisfaction!
-Karissa
Fantastic! So glad to hear it 🙂