Forums

Give every 4th image an unique dl-class in gallery? (2 posts)

  1. kazie
    Member
    Posted 4 months ago #

    How would i go about in order to give every 4th image an unique dl-class? I guess this would be done in the media.php file. I was able to echo the $id which gave every dl an unique class. I also tried to echo the $menu_order but that didn't work.

  2. alchymyth
    The Sweeper
    Posted 4 months ago #

    don't edit core files - any edits will be lost with the next upgrade.

    instead, create a new shortcode in functions.php of your theme;

    example: http://pastebin.com/zLBmu7ae

    this is the edited line:

    $output .= "<{$itemtag} class='gallery-item".(($i % $columns == 0) ? " unique" : "")."'>";

    it will set the .unique class for every column-th image; i.e if you have 4 columns, it should do what you want.

    (not widely tested)

Reply

You must log in to post.

About this Topic

Tags