Advertisement
fauzanjeg

Add Meta Info for Channel Page

Feb 5th, 2021
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.62 KB | None | 0 0
  1. /* Render Social Icon */
  2. function jnews_social_icon($author_id) {
  3.     $social_array   = array(
  4.         "url"           => "fa-globe",
  5.         "facebook"      => "fa-facebook-official",
  6.         "twitter"       => "fa-twitter",
  7.         "linkedin"      => "fa-linkedin",
  8.         "pinterest"     => "fa-pinterest",
  9.         "behance"       => "fa-behance",
  10.         "github"        => "fa-github",
  11.         "flickr"        => "fa-flickr",
  12.         "tumblr"        => "fa-tumblr",
  13.         "dribbble"      => "fa-dribbble",
  14.         "soundcloud"    => "fa-soundcloud",
  15.         "instagram"     => "fa-instagram",
  16.         "vimeo"         => "fa-vimeo",
  17.         "youtube"       => "fa-youtube-play",
  18.         "vk"            => "fa-vk",
  19.         "reddit"        => "fa-reddit",
  20.         "weibo"         => "fa-weibo",
  21.         "rss"           => "fa-rss"
  22.     );
  23.  
  24.     $socials = "";
  25.  
  26.     foreach ($social_array as $key => $value) {
  27.         if( get_the_author_meta( $key, $author_id  )){
  28.             $socials = $socials . "<a target='_blank' href='".get_the_author_meta( $key, $author_id  )."' class='".$key."'><i class='fa ".$value."'></i> </a>";
  29.         }
  30.     }
  31.  
  32.     echo jnews_sanitize_by_pass( $socials );
  33. }
  34.  
  35. /* Add Meta */
  36. function jnews_video_meta() {
  37.     $author_id = bp_displayed_user_id();
  38.     ?>
  39.     <div class="jeg_author_desc">
  40.         <?php echo wpautop(get_the_author_meta( 'description', $author_id )); ?>
  41.     </div>
  42.  
  43.     <?php if ( defined( 'JNEWS_ESSENTIAL' ) ) : ?>
  44.         <div class="jeg_author_socials">
  45.             <?php jnews_social_icon($author_id); ?>
  46.         </div>
  47.     <?php endif;
  48. }
  49.  
  50. add_action( 'bp_profile_header_meta', 'jnews_video_meta' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement