WordPress.org

Ready to get started?Download WordPress

Forums

Corpo
[resolved] Social Media Icons (6 posts)

  1. Chris
    Member
    Posted 11 months ago #

    Hello Aleksandra,

    I was just curious for a way to change the tool tips for each of the Social Media icons? For example:

    YouTube
    Subscribe to my YouTube Channel

    Twitter
    Follow me on Twitter

    Google+
    Add our Google+ to your circles

    I tried fiddling with the options.php and the custom_functions.php but nothing seemed to work. If you could show me maybe an IF statement or something for one of them, I could figure out the rest.....I hope!
    Thanks for the WONDERFUL theme!!! :-)

    Chris

  2. alex27
    Member
    Theme Author

    Posted 11 months ago #

    This title visible on hover is located in functions/custom_functions.php, but it's within a loop, so you won't be able to set different title for different social networks, unless you change how the loop works.

  3. Chris
    Member
    Posted 11 months ago #

    Thank you for your reply, Alex! I LOVE THIS THEME!!!
    I was trying to modify the custom_functions.php by adding an exception to the loop:

    foreach ( $services as $service ) :
    
        $active[$service] = of_get_option ('corpo_social_'.$service);
        if ($active[$service]) { echo '<li><a href="'.$active[$service].'" class="social-icon '. $service .'" title="'. __('Follow me on ','corpo').$service.'"></a></li>';}
    
                  //An exception for RSS
                  if ( $service == 'corpo_social_rss' ) {
                    $title = __( 'Subscribe to my RSS Feed' , 'corpo' );
                   }            
    
    endforeach;

    But I cannot get it to work. I just would like the hover titles to read a little different only on a few social icons... To read "Follow me on Facebook" instead of "Follow me on fb" or "Add me to Google+" instead of "Follow me on gp", etc.
    Could you please point me in the right direction?

  4. alex27
    Member
    Theme Author

    Posted 11 months ago #

    Your if statement should be before if ($active[$service]) - the way you did it you're trying to make a change when icon is already outputted. You should first create your variable for title and then replace __('Follow me on ','corpo').$service with your $title variable.

  5. Chris
    Member
    Posted 11 months ago #

    Thank you for your prompt reply, Alex! I did my best, but this is just way over my head. I followed your suggestion and moved my added code above the "if ($active[$service])"

    foreach ( $services as $service ) :
    
        $active[$service] = of_get_option ('corpo_social_'.$service);
    
                  //An exception for RSS
                  if ( $service == 'corpo_social_rss' ) {
                    $title = __( 'Subscribe to my RSS Feed' , 'corpo' );
                   } 
    
        if ($active[$service]) { echo '<li><a href="'.$active[$service].'" class="social-icon '. $service .'" title="'. __('Follow me on ','corpo').$service.'"></a></li>';}
    
    endforeach;

    But it didn't work. I'm not a programmer so this is all pretty foreign to me. The only reason I even was able to add what little I did was because I saw it in a theme I had once used and that exact exception was already written in so I was able to duplicate it fix the hover titles for certain social icons. This was the code that I tried to borrow it from:

    foreach ( $socials as $key => $nw) {
                  //all cases except rss
                  $title = __( 'Follow me on ' , 'THEMENAME' ).$nw;
                  $target = 'target=_blank';
                  //rss case
                  if ( $key == 'tc_rss' ) {
                    $title = __( 'Subscribe to my RSS Feed' , 'THEMENAME' );
                    $target = '';
                  }

    It was just a shot in the dark, but it didn't work out. To me, they look a little similar so I thought I could figure it out... WOW, was I wrong!! Thank you for your help. :-)

  6. qpad23
    Member
    Posted 1 month ago #

    I had the exact same issue, and I got it work.

    $services = array ('fb','twitter','gp','rss','flickr','youtube','dribble','linkedin','pinterest','vimeo','tumblr','behance','picassa','deviantart');
        $titles = array ('Facebook','Twitter','Google+','RSS','Flickr','YouTube','Dribble','LinkedIn','Pinterest','Vimeo','Tumblr','Behance','Picassa','deviantART');
        echo '<ul class="social">';
    
    	$i = 0;
    	foreach ( $services as $service ) :
    		$title = $titles[$i];
            $active[$service] = of_get_option ('corpo_social_'.$service);
            if ($active[$service]) { echo '
    
    <li><a href="'.$active[$service].'" title="'. __('Follow me on ','corpo').$title.'"></a></li>
    ';}
    		$i++;
    	endforeach;
        echo '';
    }

Reply

You must log in to post.

About this Theme

About this Topic