Skip to Content
Menu

social_url()

A consistent way to link to social network profiles

PHP January 3, 2019

Usage

PHP
nebula()->social_url($network);

Parameters

$network
(Required) (String) Which social network to return a URL for
Default: None

Parameter Notes

Options for the $network parameter include full names and abbreviations of social networks including (for example) “facebook” and “fb”.

Request or provide clarification »

Examples

Retrieve the Twitter URL

HTML
<a href="<?php echo nebula()->social_url('twitter'); ?>" target="_blank">

Additional Notes

Has an alias of social_link().

Was this page helpful? Yes No


    A feedback message is required to submit this form.


    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

    Located in /libs/Functions.php on line 1060.

    No Hooks

    This function does not have any filters or actions available. Request one?
    PHP
            public function social_url($network){
                switch ( strtolower($network) ){
                    case 'facebook':
                    case 'fb':
                        return esc_url($this->get_option('facebook_url'));
    
                    case 'twitter':
                    case 'x':
                        return $this->twitter_url(); //Use the provided function from Nebula Options
    
                    case 'linkedin':
                        return esc_url($this->get_option('linkedin_url'));
    
                    case 'instagram':
                    case 'ig':
                        return esc_url($this->get_option('instagram_url'));
    
                    case 'pinterest':
                        return esc_url($this->get_option('pinterest_url'));
    
                    case 'youtube':
                        return esc_url($this->get_option('youtube_url'));
    
                    case 'tiktok':
                        return esc_url($this->get_option('tiktok_url'));
    
                    case 'wikipedia':
                        return esc_url($this->get_option('wikipedia_url'));
    
                    default:
                        return false;
                }
    
                return false;
            }
    

    Override

    This function can not be short-circuited with an override filter. Request one?