Add New Social Options to the Social Links Widget
This is a Developer Level doc.
If you're unfamiliar with PHP and/or editing files, codes and templates, as well as with resolving possible conflict, please seek help from a professional. Under our Support Policy, we don't provide support for modifications and customization.
If you want to add new social options to the Social Links widget (Appearance > Widgets) for the Sidebar or Footer Widgets area (available only if Ocean Extra plugin is installed and active), use the following PHP snippet:
If you are using OceanWP 2.0.9 version or later, you will need to make corrections to the icon-class
part in the code.
Example:
Instead of:
'icon_class' => 'fab fa-tripadvisor',
Use this:
'icon_class' => oceanwp_icon( 'tripadvisor', false),
If your icon is not visible after the code change, make sure you have added it to the OceanWP theme icons array.
You can find the list of all available OceanWP SVG Icons here. All icons on the list also exist in the OceanWP Theme Icons array with their Font Awesome or Simple Line Icons counterparts declared.
/** * Add new social options to the Social Links Widget */ function my_ocean_social_widgets_options( $array ) { $array['snapchat'] = array( 'name' => 'Snapchat', 'icon_class' => 'fab fa-snapchat', ); // TripAdvisor icon $array['tripadvisor'] = array( 'name' => 'TripAdvisor', 'icon_class' => 'fab fa-tripadvisor', ); // Amazon icon $array['amazon'] = array( 'name' => 'Amazon', 'icon_class' => 'fab fa-amazon', ); // Line icon $array['line'] = array( 'name' => 'Line', 'icon_class' => 'fab fa-line', ); // QQ icon $array['qq'] = array( 'name' => 'QQ', 'icon_class' => 'fab fa-qq', ); // Weibo icon $array['weibo'] = array( 'name' => 'Weibo', 'icon_class' => 'fab fa-weibo', ); // Weixin icon $array['weixin'] = array( 'name' => 'Weixin', 'icon_class' => 'fab fa-weixin', ); // Return return $array; } add_filter( 'ocean_social_widget_profiles', 'my_ocean_social_widgets_options' );
*Icon classes have been altered to correspond to the Font Awesome 5 classes. If you are still using Font Awesome 4, visit the following link to get the correct class: Font Awesome 4 Icons.
Useful link: Font Awesome 5 Icons.
Changes will not affect the Social Links widget that is already assigned to a Sidebar or Footer Column, so you will need to add the widget again to its respective area and remove the existing one.
All PHP snippets should be added via a child theme's functions.php file.