Replace to class-form.php and loaded from my template resources

I build my own template. Do i can replace class form include to my custom class and saving in my template resources ? I would like to change css class in class-form.php but i wouldn’t change fill form plugin in hivepress system files.

Unfortunately, there’s no way to override the core plugin files this way, you can only override the template parts. If you mean adding a custom CSS class to all forms, you can try this code snippet:

add_filter(
	'hivepress/v1/forms/form',
	function ($form){
		if(isset($form['attributes']['class'])){
			$form['attributes']['class'] = array_merge($form['attributes']['class'], ['test']);	
		}else{
			$form['attributes']['class'] = ['test'];
		}
		
		return $form;
	},
	1000
);

The best way to customize the HivePress framework without editing its files directly is by using hooks Home | HivePress Hook Reference

1 Like