Support » Plugin: Visual Portfolio, Photo Gallery & Posts Grid » Feature Request: Adding a custom class to items

  • Resolved marekmaurizio

    (@marekmaurizio)


    I did something like this to add a custom class attribute to images items.
    The problem is, I can’t find a filter to add this class to the item output. Inspecting the code it seems it’s impossible to do it, am I wrong?

    Could this feature be added?

    add_filter('vpf_extend_image_controls', 'hd_vpf_extend_image_controls', 10, 2);
    function hd_vpf_extend_image_controls($controls, $name) {
    	$class_control = array(
    			'type'        => 'text',
    			'label'       => esc_html__( 'Additional Class', 'visual-portfolio' ),
    			'description' => esc_html__( 'Additional class for item', 'visual-portfolio' ),
    			'name'        => 'text_control_additional_class',
    			'placeholder' => esc_html__( 'some-class', 'visual-portfolio' ),
    			'default'     => ''
    	);
    	$controls['additional_class'] = $class_control;
    	return $controls;
    }
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author nK

    (@nko)

    Hey.

    In the next plugin update (will be available in 1-2 days) will be extended items args with class attribute. Currently, you can change these arguments using the filter vpf_each_item_args, but it doesn’t contain the class attribute yet.

    Regards, nK.

    Thread Starter marekmaurizio

    (@marekmaurizio)

    Wonderful, thank you.
    My goal is to assign a class to each image portfolio item so i can open a custom popup by clicking on each one.

    Thread Starter marekmaurizio

    (@marekmaurizio)

    Hello, is it possible now?

    Plugin Author nK

    (@nko)

    Hey.

    Yep, as I said using filter vpf_each_item_args.

    Regards, nK.

    Thread Starter marekmaurizio

    (@marekmaurizio)

    Yes I got it in the data. It’s still not clear how to add it to the HTML output, that’s what i was asking.

    Plugin Author nK

    (@nko)

    Hi.

    You will need to add your classes using this filter. The filter uses $args array, which has class attribute.

    $args['class'] .= ' my-new-class';
    
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Feature Request: Adding a custom class to items’ is closed to new replies.