Skip to content

Adding classes, data attributes and removing links. #22

@nwtech

Description

@nwtech

Is there a way to apply a data attribute to images? I'm currently getting taxonomy images inside my loop with this:

echo apply_filters( 'taxonomy-images-list-the-terms', '', array(
    'after' => '</ul>',
    'after_image'  => '</li>',
    'before' => '<ul class="project-services">',
    'before_image' => '<li>',
    'image_size'   => 'portfolio-showcase',
    'taxonomy'     => 'services',
) );

On that same topic, I need to also add a class to the images. I tried the following to add attributes and a class, but with no success:

echo apply_filters( 'taxonomy-images-list-the-terms', '', array(
    'after' => '</ul>',
    'after_image'  => '</li>',
    'attr' => array(
        'class' => 'filter-tint',
        'data-pb-tint-opacity' => '1',
        'data-pb-tint-colour' => '#fff',
    ),
    'before' => '<ul class="project-services">',
    'before_image' => '<li>',
    'image_size'   => 'portfolio-showcase',
    'taxonomy'     => 'services',
) );

Is it also possible to remove the links from the images?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions