• Some of my documents are for “internal” use only. I have a boolean custom field on my attachments named internal.

    I would like to add the value of the internal field as a class. This could be a string added to the %class% key. Or it could be a new key. The markup for my icons should look like this if internal is true:

    <div class="document-icon internal">

    Is there a way to do this without hacking the plugin? I saw the dg_query action in the readme, which seems like it would do the job. Can you provide an example of how this would work?

    • This topic was modified 5 years, 6 months ago by photocurio.
Viewing 1 replies (of 1 total)
  • Thread Starter photocurio

    (@photocurio)

    Actually I basically have this. dg_query isn’t needed. I did it this way:

    function dg_icon_template($icon, $description, $id) {
        $internal = get_field('internal', $id) ? 'internal' : 'external';
        $icon = '<li class="%class% ' . $internal . '"><a href="%link%" target="_blank">%title%</a>&mdash; %date%</li>';
        return $icon;
    }
    add_filter('dg_icon_template', 'dg_icon_template', 10, 3);

    I would still like to know how to add the class to %class%, instead of declaring a new variable.

Viewing 1 replies (of 1 total)
  • The topic ‘Add attachment meta to gallery item’ is closed to new replies.