css - "Scattered" gallery

admin2025-05-31  6

I'm building a theme for a portfolio-type site. I'm looking for something like this:

This site uses some kind of Foundation Grid CSS to size the thumbnails using different sizes. My question is, which method would you use to set a CSS class for every thumbnail? I'm thinking of using the attachment_fields_to_edit filter to add a CSS class field to every attachment, but I don't know if there's a better way to approach this.

function attachment_fields_to_edit( $form_fields, $post ) {
    $parent = $post->post_parent;
    if ( 'portfolio' == get_post_type( $parent ) ) {
        $form_fields['attachment-css-class'] = array(
            'label' => __( 'CSS class' ),
            'input' => 'text',
            'value' => get_post_meta( $post->ID, '_attachment-css-class', true )
        );
    }
    return $form_fields;
}

Any ideas?

Thanks in advance

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748642707a313727.html

最新回复(0)