Social Links extension. Error management. Placeholders?

Hi there,
The social links fields don’t clearly state how the URLs should be entered. A placeholder or clear error message should make this easier for users to understand what to type in.
Is there a snippet to fix this? Can’t find it on GitHub.

Please try this PHP snippet. It will add a description for social link fields

add_filter(
	'hivepress/v1/models/listing/attributes',
	function ($attributes){
		
		if(hivepress()->get_version('social_links')){
			foreach ( hivepress()->social_links->get_links( 'listing' ) as $name => $args ) {
				$attributes[$name]['edit_field'] = array_merge($attributes[$name]['edit_field'], ['description' => 'Please set url',]);
			}
		}
		
		return $attributes;
	},
	1000
);

add_filter(
	'hivepress/v1/models/vendor/attributes',
	function ($attributes){
		
		if(hivepress()->get_version('social_links')){
			foreach ( hivepress()->social_links->get_links( 'vendor' ) as $name => $args ) {
				$attributes[$name]['edit_field'] = array_merge($attributes[$name]['edit_field'], ['description' => 'Please set url',]);
			}
		}
		
		return $attributes;
	},
	1000
);
1 Like

Thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.