Skip to content

Instantly share code, notes, and snippets.

@lukeburford
Last active February 7, 2018 03:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukeburford/11c6fa82ac4018f3852a22a03b7bb830 to your computer and use it in GitHub Desktop.
Save lukeburford/11c6fa82ac4018f3852a22a03b7bb830 to your computer and use it in GitHub Desktop.
Add Jribbble to WordPress
// Load Jribbble
function lunamedia_theme_load_scripts() {
if (!is_admin()) {
if(is_page_template('page-about.php')){
// Register our Javascript
wp_register_script('jribbble', get_template_directory_uri() . '/js/jribbble.min.js', array('jquery'), false, false);
// Load our Javascript
wp_enqueue_script('jribbble');
}
}
}
add_action('wp_enqueue_scripts', 'lunamedia_theme_load_scripts');
// Somewhere in your page template
<div id="dribbble-shots" class="row">
// Get yr shots from the Dribbble
<script>
(function($) {
$.jribbble.setToken('super-secret-token-string');
$.jribbble.users('lukeburford').shots({per_page: 9}).then(function(shots) {
var html = [];
shots.forEach(function(shot) {
html.push('<div class="dribbble-shot col-sm-8">');
html.push('<a href="' + shot.html_url + '" target="_blank">');
html.push('<img src="' + shot.images.normal + '">');
html.push('</a></div>');
});
$('#dribbble-shots').html(html.join(''));
});
})( jQuery );
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment