- WordPress 2.2 or 2.0.x/2.1.x with WordPress Widgets
- PHP 4.3.0 or greater (needed for function file_get_contents)
- Displays your latest liked items (on reddit.com)
- Completely customizable display
- Caching for large traffic sites
There are 3 parts needed to format the output.
The first part, called items start in the admin panel, is the first part of the widget after the title. For the default formatting, this is just <ul>.
The second part, called items end, is the ending of the widget. By default, this is:
<a href=”%profile%” style=”float:right;”>%username%</a>
The third part is what is called for each item. By default, this is:
<li style=”list-style-type: none;”><a href=”%link%”>%title%</a> (<a href=”%more%”>more</a>)</li>
The premise of calling each value is this:
The formatting for items is:
- %title% – Title of the item
- %link% – Link to the item
- %desc% – Description of the item – Just [link] [more] links
- %date% – Date the item was submitted (ISO)
- %more% – More link – The link to the comments
- %number% – The number of the current item
The formatting for start and end is:
- %username% – Your username
- %profile% – Link to your profile
- %rss% – Link to your profile’s RSS feed
- %count% – Number of items shown
- Download reddit-widget.zip
- Extract and upload reddit.php to the plugins/ directory
- Enable reddit Widget in the Plugin admin panel
- In widget admin panel, place reddit in the sidebar, and edit it to enter your username
- Nothing shows up when I try it or I get an error that file_get_contents doesn’t exist
This script relies on the function file_get_contents to fetch the RSS feed. If your host doesn’t allow the use of it, but allows the use of curl, you can replace
$stories = file_get_contents($uri);
$ch = curl_init(); $timeout = 5; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $uri); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $stories = curl_exec($ch); curl_close($ch);
- What does cache time mean?
It’s the number of seconds before the content will be requested again. You can set this to be 0 or -1 to not use the caching system. If you edit any of the widgets in the widget admin panel, the cache is cleared.
There are no reviews for this plugin.
Contributors & Developers
“Reddit Widget” is open source software. The following people have contributed to this plugin.Contributors
Translate “Reddit Widget” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.