Skip to content

Instantly share code, notes, and snippets.

@robneu
Last active January 2, 2016 02:29
Show Gist options
  • Select an option

  • Save robneu/8237564 to your computer and use it in GitHub Desktop.

Select an option

Save robneu/8237564 to your computer and use it in GitHub Desktop.
Add a follow call to action to the bottom of the latest tweets widget for WordPress
<?php
add_filter( 'latest_tweets_render_after', 'prefix_add_follow_button', 10, 0 );
/**
* Add a follow link to the bottom of the latest tweets widget.
*
* @author FAT Media, LLC
* @link http://wpbacon.com/tutorials/latest-tweets-follow-button/
*
* @todo Change 'prefix' to your theme or plugin prefix.
* @todo Change 'text-domain' to your theme or plugin text domain.
*/
function prefix_add_follow_button() {
// Your Twitter handle.
$handle = 'yourhandle';
// Text you'd like to use for your button.
$follow_text = __( 'Follow Us On Twitter', 'text-domain' );
// HTML Markup for your button.
$content = '<footer>';
$content .= '<p><a target="_blank" href="https://twitter.com/' . $handle .'">' . $follow_text . '</a></p>';
$content .= '</footer>';
return $content;
}
/* Latest Tweets Widget
--------------------------------------------- */
.sidebar .widget.widget_latest_tweets_widget {
padding: 40px 0 0;
padding: 4rem 0 0;
}
.sidebar .widget_latest_tweets_widget .widgettitle {
padding: 0 40px;
padding: 0 4rem;
margin: 0;
}
.latest-tweets ul li {
border-bottom: 1px solid #E1E1E1;
padding: 20px 40px;
padding: 2rem 4rem;
}
.latest-tweets .tweet-text {
margin: 0 0 5px;
margin: 0 0 .5rem;
}
.latest-tweets .tweet-details time {
color: #707070;
}
.latest-tweets footer {
padding: 20px 40px;
padding: 2rem 4rem;
}
.latest-tweets footer a {
background: #2CA1FF;
border-radius: 4px;
color: #fff;
display: block;
font-size: 16px;
font-size: 1.6rem;
margin: 0;
padding: 10px;
padding: 1rem;
text-align: center;
}
.latest-tweets footer a:hover {
background: #59B5FF;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment