Employee Info "Widget"

Is it possible to add More Info’s like Twitch, linkedin or YouTube ?

I changed the “fp-employees.php” and addet

$twitch = get_post_meta( get_the_ID(), 'wpcf-twitch', true );

and

<?php if ($twitch != '') : ?>
<li><a class="twitch" href="<?php echo esc_url($twitch); ?>" target="_blank"><i class="fa fa-twitch"</i></a></li>
<?php endif; ?>

After Save and refresh the page nothing changed, is this only allowed in Sydney Pro or do i make anything false ?

“I can not coding, all what i can is try and learn how what functions” if you help me, pls make a noob tutorial for me :smiley:

Hello there,

To make it possible, I’d suggest you use jQuery approach below instead of PHP.

  1. Install and activate the TC Custom JavaScript plugin
  2. Go To Appearance > Custom JavaScript
  3. Paste the following code into the provided box

;(function($) {

   'use strict'

   if( $('.roll-team').length ){

    $('.roll-team .team-item').each(function(){

      var name    = $(this).children('.team-content').children('.name');
      var theName = $.trim(name.text());
      var url     = [];

      // New social links HTML  
      var socials = function(url){

          var html = '';

          if(url.twitch){    
              html += '<li><a href="'+url.twitch+'" target="_blank"><i class="fa fa-twitch"></i></a></li>';
          }    
          
          if(url.linkedin){   
              html += '<li><a href="'+url.linkedin+'" target="_blank"><i class="fa fa-linkedin"></i></a></li>';
          }

          if(url.youtube){    
              html += '<li><a href="'+url.youtube+'" target="_blank"><i class="fa fa-youtube"></i></a></li>';
          }  

          return html;
          
      }

      // Social links for Jane Doe
      if(theName == 'Jane Doe'){
        url = {
          'twitch': 'http://twitch.com/jane-doe',
          'linkedin': 'http://linkedin.com/jane-doe',
          'youtube': 'http://youtube.com/jane-doe'
        }
      }

      // Social links for John Doe
      if(theName == 'John Doe'){
        url = {
          'twitch': 'http://twitch.com/john-doe',
          'linkedin': 'http://linkedin.com/john-doe',
          'youtube': 'http://youtube.com/john-doe'
        }
      }    

      // Social links for Chris Donovan
      if(theName == 'Chris Donovan'){
        url = {
          'twitch': 'http://twitch.com/c-donovan',
          'linkedin': 'http://linkedin.com/c-donovan',
          'youtube': 'http://youtube.com/c-donovan'
        }
      }  

      // Insert new social links
      $(this).find('.team-social').append(socials(url));
      
    });
   
   }

})(jQuery);

  1. Update

From the code above, it inserts some new social profiles (Twitch, Linkedin and YouTube) for given names: Jane Doe, John Doe, and Chris Donovan. Adjust the names of your employees and set their links with this code block:


// Social links for Jane Doe
if(theName == 'Jane Doe'){
  url = {
    'twitch': 'http://twitch.com/jane-doe',
    'linkedin': 'http://linkedin.com/jane-doe',
    'youtube': 'http://youtube.com/jane-doe'
  }
}

I hope it helps.

Regards,
Kharis

Hi Kharis, it works thanks :smiley:

There is no way to add thaht in 3 new catogory in this widget if a other “admin” add a new employee is it easyer for him to change thaht, do i need a child theme if i want add more Info’s for employee ?

How i can change the employee url i mean like that

http://localhost/wordpress/employees/ in http://localhost/wordpress/streamer/

i changed in “sydney-toolbox/inc/post-type-employees.php”

$slug = apply_filters( ‘sydney_employees_rewrite_slug’, ‘employees’ ); idk what that do i tested and he change the end of the url so i have replaced “employees” in “streamer” but if i want see the profile is coming “site not found”

Best Regrads
Xore

There is no other easier way than what I suggested.

To change the base url of the employees post type, please don’t touch the core code. You can rewrite it using specified filter, sydney_employees_rewrite_slug, from your child theme’s functions.php file; add the following code:


add_filter('sydney_employees_rewrite_slug', 'sydney_child_employees_slug');
function sydney_child_employees_slug(){
	return 'streamer';
}

If you don’t want to use a child theme, alternatively you can use functionality plugin like Code Snippets.

Once you applied it, you need to resave your site’s permalink structure; go to Settings > Permalinks > just hist the save button.

Regards,
Kharis

Thank you very much, everything has worked

Great! You’re always welcome here. :slight_smile:

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

If you don’t mind, could you please rate our Sydney theme here:https://wordpress.org/support/view/theme-reviews/sydney#postform? We would highly appreciate it if you do so.

Regards,
Kharis