Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
$10
Integrate plugin into functions.php
<?php
function wpDribbble() {
include_once(ABSPATH . WPINC . '/feed.php');
$options = get_option("widget_wpDribbble");
$playerName = $options['playerName'];
if(function_exists('fetch_feed')):
$rss = fetch_feed("http://dribbble.com/players/$playerName/shots.rss");
add_filter( 'wp_feed_cache_transient_lifetime', create_function( '$a', 'return 1800;' ) );
if (!is_wp_error( $rss ) ) :
$items = $rss->get_items(0, $rss->get_item_quantity($options['maxItems']));
endif;
endif;
if (!empty($items)): ?>
<ol class="dribbbles">
<?php
foreach ( $items as $item ):
$title = $item->get_title();
$link = $item->get_permalink();
$date = $item->get_date('F d, Y');
$description = $item->get_description();
preg_match("/src=\"(http.*(jpg|jpeg|gif|png))/", $description, $image_url);
$image = $image_url[1];
if(!$options['bigImage']) {
$image = preg_replace('/.(jpg|jpeg|gif|png)/', '_teaser.$1',$image); #comment this out if you want to use the big 400x300 image
}
?>
<li class="group">
<div class="dribbble">
<div class="dribbble-shot">
<div class="dribbble-img">
<a href="<?php echo $link; ?>" class="dribbble-link"><img src="<?php echo $image; ?>" alt="<?php echo $title;?>"/></a>
<a href="<?php echo $link; ?>" class="dribbble-over"><?php echo $title; ?>
<span class="dim"><?php echo $options['playerName'] ?></span>
<?php echo $date; ?>
</a>
</div>
</div>
</div>
</li>
<?php endforeach;?>
</ol>
<?php endif;
}
function wpDribbble_head() {
$options = get_option("widget_wpDribbble");
$dir = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
?>
<!-- wp-dribbble plugin -->
<style type="text/css">
.dribbbles{list-style-type:none;margin:0px 0px 1.5em;}
.dribbbles li{font-size:15px;position:relative;width:220px;padding:0;margin:0 0 1.5em 0;}
.dribbbles .dribbble{font-family:"Helvetica Nueue", Helvetica, Arial, sans-serif;position:relative;clear:left;overflow:hidden;<?php if($options['dropShadow']):?>padding:0 0 10px 0;background:url(<?php echo $dir; ?>images/dribbblesprite.png) no-repeat -10px -480px;<?php else:?>border-bottom:1px solid #e5e5e5;<?php endif;?>}
.dribbbles .dribbble-shot{padding:10px;background:url(<?php echo $dir; ?>images/dribbblesprite.png) no-repeat -10px -330px;}
.dribbbles .dribbble-over{position:absolute;top:10px;left:10px;z-index:1;width:180px;height:130px;margin:0!important;padding:10px;font-size:0.8em;line-height:2em;text-decoration:none;color:#888;background:url(<?php echo $dir; ?>images/dribbblesprite.png) no-repeat -110px -160px;}
.dribbbles .dribbble-link{position:relative;z-index:2;}
.dribbbles img{margin:0;width:200px;height:auto;opacity:1;-webkit-transition:opacity 0.2s linear;-o-transition:opacity 0.2s linear;-moz-transition:opacity 0.2s linear;}
.dribbbles a:hover img{opacity:0.1;-webkit-transition:opacity 0.2s linear;-o-transition:opacity 0.2s linear;-moz-transition:opacity 0.2s linear;}
.dribbbles strong{display:block;font-weight:bold;font-size:1.4em;line-height:1.2em;color:#ea4c88;}
.dribbbles .dim{font-weight:bold;color:#666;}
.dribbbles em{position: absolute;bottom:11px;left:10px;font-size:1em;line-height:1em;font-weight:normal;font-style:normal;}
.dribbbles .dribbble-img{width:200px;height:150px;overflow:hidden;}
</style>
<?php
}
function wpDribbble_control() {
$options = get_option("widget_wpDribbble");
if (!is_array( $options )) {
$options = array(
'playerName'=> 'Your Player Name',
'maxItems' => '5',
'includeCSS' => true,
'dropShadow' => true,
'bigImage' => false
);
}
if ($_POST['wpDribbble-Submit']) {
$options['playerName'] = htmlspecialchars($_POST['wpDribbble-WidgetPlayerName']);
$options['maxItems'] = htmlspecialchars($_POST['wpDribbble-WidgetMaxItems']);
$options['includeCSS'] = htmlspecialchars($_POST['wpDribbble-WidgetIncludeCSS']);
$options['dropShadow'] = htmlspecialchars($_POST['wpDribbble-WidgetDropShadow']);
$options['bigImage'] = htmlspecialchars($_POST['wpDribbble-WidgetBigImage']);
update_option("widget_wpDribbble", $options);
}
?>
<style type="text/css">
.labbbel { width: 90px; display:inline-block; }
.quiet { color:#CCC;}
</style>
<p>
<label class="labbbel" for="wpDribbble-WidgetPlayerName">Player Name: </label>
<input type="text" id="wpDribbble-WidgetPlayerName" name="wpDribbble-WidgetPlayerName" value="<?php echo $options['playerName'];?>" />
</p>
<p>
<label class="labbbel" for="wpDribbble-WidgetMaxItems">No. of Shots: </label>
<select id="wpDribbble-WidgetMaxItems" name="wpDribbble-WidgetMaxItems">
<option value="1" <?php if($options['maxItems'] == 1) echo "selected";?>>1</option>
<option value="2" <?php if($options['maxItems'] == 2) echo "selected";?>>2</option>
<option value="3" <?php if($options['maxItems'] == 3) echo "selected";?>>3</option>
<option value="4" <?php if($options['maxItems'] == 4) echo "selected";?>>4</option>
<option value="5" <?php if($options['maxItems'] == 5) echo "selected";?>>5</option>
<option value="6" <?php if($options['maxItems'] == 6) echo "selected";?>>6</option>
<option value="7" <?php if($options['maxItems'] == 7) echo "selected";?>>7</option>
<option value="8" <?php if($options['maxItems'] == 8) echo "selected";?>>8</option>
<option value="9" <?php if($options['maxItems'] == 9) echo "selected";?>>9</option>
<option value="10" <?php if($options['maxItems'] == 10) echo "selected";?>>10</option>
</select>
</p>
<p>
<label class="labbbel" for="wpDribbble-WidgetIncludeCSS">Include CSS? </label>
<input type="checkbox" id="wpDribbble-WidgetIncludeCSS" name="wpDribbble-WidgetIncludeCSS" <?php if($options['includeCSS']) echo "checked";?>>
<em class="quiet">Default: On
</p>
<p>
<label class="labbbel" for="wpDribbble-WidgetDropShadow">Drop shadow? </label>
<input type="checkbox" id="wpDribbble-WidgetDropShadow" name="wpDribbble-WidgetDropShadow" <?php if($options['dropShadow']) echo "checked";?>>
<em class="quiet">Default: On
</p>
<p>
<label class="labbbel" for="wpDribbble-WidgetBigImage">Big Image? </label>
<input type="checkbox" id="wpDribbble-WidgetBigImage" name="wpDribbble-WidgetBigImage" <?php if($options['bigImage']) echo "checked";?>>
<em class="quiet">Default: Off
</p>
<input type="hidden" id="wpDribbble-Submit" name="wpDribbble-Submit" value="1" />
<?php
}
function widget_wpDribbble($args) {
extract($args);
echo $before_widget;
echo $before_title;?>Dribbble<?php echo $after_title;
wpDribbble();
echo $after_widget;
}
function wpDribbble_init()
{
$options = get_option("widget_wpDribbble");
wp_register_sidebar_widget(__('Dribbble'),__('Dribbble'), 'widget_wpDribbble' ,array('description' => 'Pull in your latest Dribbble shots'));
register_widget_control( 'Dribbble', 'wpDribbble_control');
add_action( 'wp_dribbble', 'wpDribbble' );
if($options['includeCSS']) {
add_action('wp_head', 'wpDribbble_head');
}
}
add_action("plugins_loaded", "wpDribbble_init");
?>
This question has been answered.
Mike McAlister | 06/07/11 at 11:26pm
Edit
(4) Possible Answers Submitted...
See a chronological view of answers?
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
-

Last edited:
06/07/11
11:35pmDenzel Chia says:Hi,
If the whole plugin is in a single php file.
For example plugin.php
1) Remove the plugin header, which is the comments.
2) save the plugin.php into your theme folder and same level with functions.php
3) in functions.php put the below codes,
require_once(dirname(__FILE__) . "/plugin.php");
Hope I did not make a mistake here.
Thanks,
Denzel- 06/07/11 11:40pm
Mike McAlister says:I seem to be getting a 500 error with this fix.
Mike - 06/07/11 11:46pm
Denzel Chia says:Hi,
Does it only show this 500 error, there is some kind of error line number?
Thanks.
Denzel - 06/08/11 12:14am
Denzel Chia says:Hi Mike,
If you don't mind, Please email me your theme to email@denzeldesigns.com
I can add it in for you.
In fact I had it working on my localhost using twenty ten.
You need to change the following too.
from
$dir = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
to
$dir = get_bloginfo('template_url')."/";
so that path to image is
http://example.com/wp-content/themes/twentyten/images/dribbblesprite.png
from
add_action("plugins_loaded", "wpDribbble_init");
to
add_action("init", "wpDribbble_init");
So that the widget will show.
Attached screenshot of widget with player name kimballfrank
Thanks.
Denzel - 06/08/11 11:07pm
Mike McAlister says:Thanks Denzel! Your latest modifications got it working. This is what I was looking for, thanks!
Mike
- 06/07/11 11:40pm
-

Last edited:
06/07/11
11:48pmJerson Baguio says:A simple iteration to Denzil answer:
You could try
require_once(TEMPLATEPATH . '/plugin.php');
since its in a template. -

Last edited:
06/08/11
12:17amAndrzej Zglobica says:To Jerson's aswer - you might rather try STYLESHEETPATH to make it child-theme proof.
Note that action 'plugins_loaded' will not run within theme's functions.php (seems to be working only from plugins). Instead you might want hook 'wpDribbble_init' to 'init' for example.
(so:
add_action("plugins_loaded", "wpDribbble_init");
becomes
add_action("init", "wpDribbble_init");
)Previous versions of this answer: 06/08/11 at 12:17am
-

Last edited:
06/11/11
7:51amJeremy Jared says:I know this isn't exactly what you are asking for, but really the solution of adding it to the functions.php doesn't solve any performance issues.
This is a little know trick to adding single file plug-ins to WP websites. Open your sites FTP, create a folder directly inside the wp-content folder named mu-plugins. Place the following code into your text editor and name it the same name (without the spaces uses - where the spaces are example: your-function.php), save it and upload it to the mu-plugins folder. You will notice that there is a new section called MU plugins in the plugin page. It can't be disabled or edited from the WP-Admin. You will have to delete it from the folder.
Here's the code:
<?php
/*
Plugin Name: Your Name
Version: 1.0
Plugin URI: http://something.com/
Description: Something here
Author: Your name
Author URI: http://yourwebsite.com/
*/
function wpDribbble() {
include_once(ABSPATH . WPINC . '/feed.php');
$options = get_option("widget_wpDribbble");
$playerName = $options['playerName'];
if(function_exists('fetch_feed')):
$rss = fetch_feed("http://dribbble.com/players/$playerName/shots.rss");
add_filter( 'wp_feed_cache_transient_lifetime', create_function( '$a', 'return 1800;' ) );
if (!is_wp_error( $rss ) ) :
$items = $rss->get_items(0, $rss->get_item_quantity($options['maxItems']));
endif;
endif;
if (!empty($items)): ?>
<ol class="dribbbles">
<?php
foreach ( $items as $item ):
$title = $item->get_title();
$link = $item->get_permalink();
$date = $item->get_date('F d, Y');
$description = $item->get_description();
preg_match("/src=\"(http.*(jpg|jpeg|gif|png))/", $description, $image_url);
$image = $image_url[1];
if(!$options['bigImage']) {
$image = preg_replace('/.(jpg|jpeg|gif|png)/', '_teaser.$1',$image); #comment this out if you want to use the big 400x300 image
}
?>
<li class="group">
<div class="dribbble">
<div class="dribbble-shot">
<div class="dribbble-img">
<a href="<?php echo $link; ?>" class="dribbble-link"><img src="<?php echo $image; ?>" alt="<?php echo $title;?>"/></a>
<a href="<?php echo $link; ?>" class="dribbble-over"><?php echo $title; ?>
<span class="dim"><?php echo $options['playerName'] ?></span>
<?php echo $date; ?>
</a>
</div>
</div>
</div>
</li>
<?php endforeach;?>
</ol>
<?php endif;
}
function wpDribbble_head() {
$options = get_option("widget_wpDribbble");
$dir = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
?>
<!-- wp-dribbble plugin -->
<style type="text/css">
.dribbbles{list-style-type:none;margin:0px 0px 1.5em;}
.dribbbles li{font-size:15px;position:relative;width:220px;padding:0;margin:0 0 1.5em 0;}
.dribbbles .dribbble{font-family:"Helvetica Nueue", Helvetica, Arial, sans-serif;position:relative;clear:left;overflow:hidden;<?php if($options['dropShadow']):?>padding:0 0 10px 0;background:url(<?php echo $dir; ?>images/dribbblesprite.png) no-repeat -10px -480px;<?php else:?>border-bottom:1px solid #e5e5e5;<?php endif;?>}
.dribbbles .dribbble-shot{padding:10px;background:url(<?php echo $dir; ?>images/dribbblesprite.png) no-repeat -10px -330px;}
.dribbbles .dribbble-over{position:absolute;top:10px;left:10px;z-index:1;width:180px;height:130px;margin:0!important;padding:10px;font-size:0.8em;line-height:2em;text-decoration:none;color:#888;background:url(<?php echo $dir; ?>images/dribbblesprite.png) no-repeat -110px -160px;}
.dribbbles .dribbble-link{position:relative;z-index:2;}
.dribbbles img{margin:0;width:200px;height:auto;opacity:1;-webkit-transition:opacity 0.2s linear;-o-transition:opacity 0.2s linear;-moz-transition:opacity 0.2s linear;}
.dribbbles a:hover img{opacity:0.1;-webkit-transition:opacity 0.2s linear;-o-transition:opacity 0.2s linear;-moz-transition:opacity 0.2s linear;}
.dribbbles strong{display:block;font-weight:bold;font-size:1.4em;line-height:1.2em;color:#ea4c88;}
.dribbbles .dim{font-weight:bold;color:#666;}
.dribbbles em{position: absolute;bottom:11px;left:10px;font-size:1em;line-height:1em;font-weight:normal;font-style:normal;}
.dribbbles .dribbble-img{width:200px;height:150px;overflow:hidden;}
</style>
<?php
}
function wpDribbble_control() {
$options = get_option("widget_wpDribbble");
if (!is_array( $options )) {
$options = array(
'playerName'=> 'Your Player Name',
'maxItems' => '5',
'includeCSS' => true,
'dropShadow' => true,
'bigImage' => false
);
}
if ($_POST['wpDribbble-Submit']) {
$options['playerName'] = htmlspecialchars($_POST['wpDribbble-WidgetPlayerName']);
$options['maxItems'] = htmlspecialchars($_POST['wpDribbble-WidgetMaxItems']);
$options['includeCSS'] = htmlspecialchars($_POST['wpDribbble-WidgetIncludeCSS']);
$options['dropShadow'] = htmlspecialchars($_POST['wpDribbble-WidgetDropShadow']);
$options['bigImage'] = htmlspecialchars($_POST['wpDribbble-WidgetBigImage']);
update_option("widget_wpDribbble", $options);
}
?>
<style type="text/css">
.labbbel { width: 90px; display:inline-block; }
.quiet { color:#CCC;}
</style>
<p>
<label class="labbbel" for="wpDribbble-WidgetPlayerName">Player Name: </label>
<input type="text" id="wpDribbble-WidgetPlayerName" name="wpDribbble-WidgetPlayerName" value="<?php echo $options['playerName'];?>" />
</p>
<p>
<label class="labbbel" for="wpDribbble-WidgetMaxItems">No. of Shots: </label>
<select id="wpDribbble-WidgetMaxItems" name="wpDribbble-WidgetMaxItems">
<option value="1" <?php if($options['maxItems'] == 1) echo "selected";?>>1</option>
<option value="2" <?php if($options['maxItems'] == 2) echo "selected";?>>2</option>
<option value="3" <?php if($options['maxItems'] == 3) echo "selected";?>>3</option>
<option value="4" <?php if($options['maxItems'] == 4) echo "selected";?>>4</option>
<option value="5" <?php if($options['maxItems'] == 5) echo "selected";?>>5</option>
<option value="6" <?php if($options['maxItems'] == 6) echo "selected";?>>6</option>
<option value="7" <?php if($options['maxItems'] == 7) echo "selected";?>>7</option>
<option value="8" <?php if($options['maxItems'] == 8) echo "selected";?>>8</option>
<option value="9" <?php if($options['maxItems'] == 9) echo "selected";?>>9</option>
<option value="10" <?php if($options['maxItems'] == 10) echo "selected";?>>10</option>
</select>
</p>
<p>
<label class="labbbel" for="wpDribbble-WidgetIncludeCSS">Include CSS? </label>
<input type="checkbox" id="wpDribbble-WidgetIncludeCSS" name="wpDribbble-WidgetIncludeCSS" <?php if($options['includeCSS']) echo "checked";?>>
<em class="quiet">Default: On
</p>
<p>
<label class="labbbel" for="wpDribbble-WidgetDropShadow">Drop shadow? </label>
<input type="checkbox" id="wpDribbble-WidgetDropShadow" name="wpDribbble-WidgetDropShadow" <?php if($options['dropShadow']) echo "checked";?>>
<em class="quiet">Default: On
</p>
<p>
<label class="labbbel" for="wpDribbble-WidgetBigImage">Big Image? </label>
<input type="checkbox" id="wpDribbble-WidgetBigImage" name="wpDribbble-WidgetBigImage" <?php if($options['bigImage']) echo "checked";?>>
<em class="quiet">Default: Off
</p>
<input type="hidden" id="wpDribbble-Submit" name="wpDribbble-Submit" value="1" />
<?php
}
function widget_wpDribbble($args) {
extract($args);
echo $before_widget;
echo $before_title;?>Dribbble<?php echo $after_title;
wpDribbble();
echo $after_widget;
}
function wpDribbble_init()
{
$options = get_option("widget_wpDribbble");
wp_register_sidebar_widget(__('Dribbble'),__('Dribbble'), 'widget_wpDribbble' ,array('description' => 'Pull in your latest Dribbble shots'));
register_widget_control( 'Dribbble', 'wpDribbble_control');
add_action( 'wp_dribbble', 'wpDribbble' );
if($options['includeCSS']) {
add_action('wp_head', 'wpDribbble_head');
}
}
add_action("plugins_loaded", "wpDribbble_init");
?>
THIS WEBSITE SUCKS!!!!!!!!!!
NO ONE EVER REPLIES, I'VE GIVEN CORRECT ANSWERS>
WHAT A F'IN WASTE OF MY TIME
Y'ALL CAN KISS MY ASS!Previous versions of this answer: 06/11/11 at 7:51am
This question has expired.
Mike McAlister voted on this question.
Current status of this question: Completed
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
