Grow your CSS skills. Land your dream job.

Assign Classes to Gallery Images

  • # September 10, 2012 at 11:35 am

    So, I’m using the WP Simple Galleries plugin and I was wondering if it’s possible to modify the code to say, if the gallery say has 4 or more images then assign an array of unique classes to each of the images like so:




    Here’s the PHP that returns the gallery:

    private function thumb($id, $post_id) {
    $image = wp_get_attachment_image_src($id, ‘wpsimplegallery_thumb’, true);
    $info = get_posts(array(‘p’ => $id, ‘post_type’ => ‘attachment’));
    return ‘

  • post_title . ‘” rel=”wpsimplegallery_group_’ . $post_id . ‘”>
  • ‘;
    }

    And here’s a link to the complete wp-simple-gallery.php file.

    I’m still trying to grasp PHP, and I’m sure this can this be done using arrays and an if statement of some sort. If anyone could help lead me in the right direction it would be much appreciated.

    Thanks in advance.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".