Adding social links in header – Supreme

This topic contains 1 reply, has 2 voices, and was last updated by  Alex Rollin 6 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #427218

    Joy
    Buyer
    Post count: 1076

    Hello,I have added an Instagram icon/link into the supreme header. I am also trying to add a icon/link for linkedin and Soundcloud. But with my following code, the social links now only show up if ALL files are populated. Should I be doing something differently? Thank you.

    
    
    add_filter('sd_details_output_social','_my_extra_social_details',10);
    function _my_extra_social_details($output){
    	global $post;
    
    	if(isset($post->geodir_instagram) && $post->geodir_instagram){
    
    if (strpos($output, 'fa-external-link-square') !== false) {
    $output = str_replace('fa-external-link-square"></i></a>','fa-external-link-square"></i></a><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_instagram) . '"><i class="fa fa-instagram"></i></a>',$output);
    }elseif (strpos($output, 'fa-facebook-official') !== false) {
    $output = str_replace('fa-external-link-square"></i></a>','fa-facebook-official"></i></a><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_instagram) . '"><i class="fa fa-instagram"></i></a>',$output);
    }elseif (strpos($output, 'fa-twitter-square') !== false) {
    $output = str_replace('fa-external-link-square"></i></a>','fa-twitter-square"></i></a><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_instagram) . '"><i class="fa fa-instagram"></i></a>',$output);
    }else{
    $output = str_replace('<div class="sd-contacts">','<div class="sd-contacts"><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_instagram) . '"><i class="fa fa-instagram"></i></a>',$output);
    }
    	  
    	if(isset($post->geodir_linkedin) && $post->geodir_linkedin){
    
    if (strpos($output, 'fa-external-link-square') !== false) {
    $output = str_replace('fa-external-link-square"></i></a>','fa-external-link-square"></i></a><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_linkedin) . '"><i class="fa fa-linkedin"></i></a>',$output);
    }elseif (strpos($output, 'fa-facebook-official') !== false) {
    $output = str_replace('fa-external-link-square"></i></a>','fa-facebook-official"></i></a><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_linkedin) . '"><i class="fa fa-linkedin"></i></a>',$output);
    }elseif (strpos($output, 'fa-twitter-square') !== false) {
    $output = str_replace('fa-external-link-square"></i></a>','fa-twitter-square"></i></a><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_linkedin) . '"><i class="fa fa-linkedin"></i></a>',$output);
    }else{
    $output = str_replace('<div class="sd-contacts">','<div class="sd-contacts"><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_linkedin) . '"><i class="fa fa-linkedin"></i></a>',$output);
    }
    	  
    	if(isset($post->geodir_soundcloud) && $post->geodir_soundcloud){
    
    if (strpos($output, 'fa-external-link-square') !== false) {
    $output = str_replace('fa-external-link-square"></i></a>','fa-external-link-square"></i></a><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_soundcloud) . '"><i class="fa fa-soundcloud"></i></a>',$output);
    }elseif (strpos($output, 'fa-facebook-official') !== false) {
    $output = str_replace('fa-external-link-square"></i></a>','fa-facebook-official"></i></a><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_soundcloud) . '"><i class="fa fa-soundcloud"></i></a>',$output);
    }elseif (strpos($output, 'fa-twitter-square') !== false) {
    $output = str_replace('fa-external-link-square"></i></a>','fa-twitter-square"></i></a><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_soundcloud) . '"><i class="fa fa-soundcloud"></i></a>',$output);
    }else{
    $output = str_replace('<div class="sd-contacts">','<div class="sd-contacts"><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_soundcloud) . '"><i class="fa fa-soundcloud"></i></a>',$output);
    }
    
    // replace some icons
    $output = str_replace('fa-facebook-official','fa-facebook',$output);
    $output = str_replace('fa-linkedin','fa-linkedin',$output);
    $output = str_replace('fa-twitter-square','fa-twitter',$output);
    $output = str_replace('fa-phone-square','fa-phone',$output);
    $output = str_replace('fa-external-link-square','fa-link',$output);
    
    	}
    	return $output;
    }}}
    #427287

    Alex Rollin
    Moderator
    Post count: 27815

    Hello!

    The examples provided are to get you started. For further help with customization please contact a GD Expert: https://geodirectoryexperts.com

    Example Reference: https://wpgeodirectory.com/docs/faqs/detail-page/

Viewing 2 posts - 1 through 2 (of 2 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket