Adding social links in header – Supreme
This topic contains 1 reply, has 2 voices, and was last updated by Alex Rollin 6 years, 7 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
April 19, 2018 at 9:44 am #427218
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; }}}
April 19, 2018 at 5:33 pm #427287Hello!
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/
-
AuthorPosts
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
To open a new support ticket, first select the relevant forum and then click the "New Post" button. Example: You need support for the core plugin? Click on Core Plugin support and click on the "New Post" Button.
Please read our support policy before starting to use the forum.