====== Documentation ======
After installing the plugin (either on Wordpress or Standalone Mode) you have to configure it to run on your environment. As of version
0.62, Featplug does have native [[http://featplug.huseyinuslu.net/documentation#wordpress_mu_support|Wordpress-MU support]].
======= Using with Wordpress =======
With Wordpress you can run the plugin in either widget mode or directly call it under your template.
====== Wordpress Widget Mode ======
- After [[installation|installing]] the plugin and activating, goto Wordpress **Dashboard** ~ **Design** ~ **Widgets**.
- On the left, find the **FeatPlug** widget and press **Add**.
- On the right side, find the new added widget and press **Edit**.
- You'll see a screen similar to this;
{{:fp.0.59.widget.png|}}
===== Configure the options; =====
* **Widget Title**: Title to be shown
* **Image Width**: Output Image Width
* **Image Height**: Output Image Height
* **Enable Image Enlarging**: Enlarges smaller images if set.
* **Template**: Output template
* **Max Items**: Maximum number of stories to be shown.
* **Post Filters**: Wordpress Post Filter.((Check http://codex.wordpress.org/Template_Tags/get_posts and http://www.huseyinuslu.net/wp-post-banners-wordpress-filters/ for more information))
====== Direct Plugin Call ======
In this mode, instead of using widgets, you edit your current blog template (from Design ~ Theme Editor) section and \\
call the plugin from your theme code (you'll mostly want to put it under header.php or similar). \\
\\
Right now FeatPlug supplies 3 functions to use with Wordpress;
* **featplug_wp_render()**
* **featplug_wp_render_slideshow()**
* **featplug_wp_render_banners()**
===== featplug_wp_render() - Output Template Selection =====
Mines Wordpress posts and renders a maximum number of given stories. This function enables **selecting the output template** manually.
function featplug_wp_render($width,$height,$image_enlarging,$template,$max_stories=10,$filter='')
**Parameters:** \\
* **Width**: (//Integer//) Output Width
* **Height**: (//Integer//) Output Height
* **Image_Enlarging**: (//Boolean//) Enable Image Enlarging?
* **Template**: (//String//) Template name to be used
* **Max_Stories**: (//Integer//) Maximum Number Of Stories To Show //**Optional Parameter**//
* **Filter**: (//String//) Wordpress Post Filter((Check http://codex.wordpress.org/Template_Tags/get_posts and http://www.huseyinuslu.net/wp-post-banners-wordpress-filters/ for more information)) //**Optional Parameter**//
**Example Code:**
This example;
* Renders '**smoothgallery**' template - we selected the //slideshow template// manually.
* Output dimensions **525 x 290 pixels**
* **images enlarged if needed**
* Wordpress will just return ** latest 10 posts** to plugin (by the filter 'numberposts=10')
* FeatPlug will at maximum show **10 suitable stories**
\\
\\
===== featplug_wp_render_slideshow() - Slideshow =====
Mines Wordpress posts and **renders a slideshow** with a maximum number of given stories.
function featplug_wp_render_slideshow($width,$height,$image_enlarging,$max_stories=10,$filter='')
**Parameters:** \\
* **Width**: (//Integer//) Output Width
* **Height**: (//Integer//) Output Height
* **Image_Enlarging**: (//Boolean//) Enable Image Enlarging?
* **Max_Stories**: (//Integer//) Maximum Number Of Stories To Show //**Optional Parameter**//
* **Filter**: (//String//) Wordpress Post Filter((Check http://codex.wordpress.org/Template_Tags/get_posts and http://www.huseyinuslu.net/wp-post-banners-wordpress-filters/ for more information)) //**Optional Parameter**//
**Example Code:**
This example;
* Renders a **slideshow**
* Output dimensions **300 x 100 pixels**
* But **without enlarged images**
* Wordpress will just return ** random 15 posts** to plugin (by the filter 'numberposts=15&orderby=rand')
* FeatPlug will at maximum show **5 suitable stories**
\\
\\
===== featplug_wp_render_banners() - Simple Banners =====
Mines Wordpress posts and **renders simple banners** with a maximum number of given stories.
function featplug_wp_render_banners($width,$height,$image_enlarging,$max_stories=10,$filter='')
**Parameters:** \\
* **Width**: (//Integer//) Output Width
* **Height**: (//Integer//) Output Height
* **Image_Enlarging**: (//Boolean//) Enable Image Enlarging?
* **Max_Stories**: (//Integer//) Maximum Number Of Stories To Show //**Optional Parameter**//
* **Filter**: (//String//) Wordpress Post Filter((Check http://codex.wordpress.org/Template_Tags/get_posts and http://www.huseyinuslu.net/wp-post-banners-wordpress-filters/ for more information)) //**Optional Parameter**//
**Example Code:**
This example;
* Renders simple banners
* Output dimensions **450 x 200 pixels**
* **without enlarged images**
* Wordpress will just return ** latest 5 posts** to plugin (by the filter 'numberposts=5')
* FeatPlug will at maximum show **3 suitable stories**
\\
\\
===== Output Templates =====
It's quite easy to create your own template with FeatPlug. Also by default it comes with pre-defined templates;
* **smootgallery** - Slideshow template based on [[http://smoothgallery.jondesign.net/|SmoothGallery]] - [[http://postbanners.huseyinuslu.net/index.php?wptheme=Slideshow|Demo]].
WP-Post-Banners 0.5 preview - Slideshow feature from raistlinthewiz on Vimeo.
* **simple_banners** - Basic banners template - [[http://postbanners.huseyinuslu.net/index.php?wptheme=get_post_banners|Demo]].
{{http://www.huseyinuslu.net/wp-content/uploads/2008/08/wpb05-222x300.jpg}}
* **debug** - Debug template, for reporting bugs.
* **imagemenu** - Image Menu template based on [[http://www.phatfusion.net/imagemenu/]].
====== Wordpress MU Support ======
With version 0.62, native Wordpress-MU support have been added to Featplug. The plugin will just recognize Wordpress-MU environment and will morph itself. With Wordpress-MU, the plugin will find out latest updated blogs from the MU environment and will mine their contents and render the output.
Everything is handled automatically, you don't need to hack anything for MU support. Just install (check directions for [[http://featplug.huseyinuslu.net/installation#installing_for_wordpress-mu|Wordpress-MU based installation]]) and put [[http://featplug.huseyinuslu.net/documentation#direct_plugin_call|plugin]] call in your theme.
Here's a [[http://int6.org/wpmu/|MU-demo site]] which uses the Featplug 0.62
====== StandAlone Mode ======
With the release of 0.5 version you can just run the FeatPlug as a standalone script. You can use it your own static site\\
by supplying data manually or even use it in any other blog / CMS / forum software by just writing the data pump function.
\\
\\
Check [[http://postbanners.huseyinuslu.net/wp-content/plugins/wp-post-banners/standalone.php|here]] to see a stand-alone demo.
\\
\\
Under /examples directory of plugins distribution there exists [[standalone.php]] and [[featplug_demo.php]].
First lets see manual data pumping;
1) Include engine.php in your site
include 'engine.php';
2) Initiate the engine class
$e=new engine();
$e->layer("STAND_ALONE"); // select the output layer
3) Set configuration; width, height and maximum items
$e->set_output_dimensions(500,350); // output image dimensions
$e->set_maximum_stories(5); // maximum number of strories to show
$e->set_story_lenght(150); // story text lenght
$e->set_thumbnail_dimensions(50,50); // thumbnail dimensions
$e->enable_image_enlarging(True); // enlarge images?
4) Start pumping the content
$p=new post_item();
$p->img="";
$p->label="Sample Post I";
$p->content="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et.";
$e->add_item($p);
$p=new post_item();
$p->img="";
$p->label="Sample Post II";
$p->content="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et.";
$e->add_item($p);
5) Let the wp-post-banners do the magic and render.
$e->set_template("smoothgallery"); // Set out template; slideshow
echo $e->render();
6) Free the resources used
$e=null; // release resources
====== Porting plugin to other Blog / CMS / Forum Software ======
By reading the standalone instructions and following sample data pumper for Wordpress you can just port the plugin to any other blog / cms / forum software with coding a few lines.
To do so, take this Wordpress pumper code as a basis for your work and don't forget to mention it on support forums about your work so that we can include it with plugin's main distribution.
**pump_wordpress_data()** is the key part to mining Wordpress. With few changes to this function it can be easly ported to other CMS/Blog/Forum software.
function pump_wordpress_data($filter,engine $e)
{
$posts=get_posts($filter);
foreach($posts as $post)
{
setup_postdata($post);
$p=new post_item();
$p->img=$post->post_content;
$p->content=$post->post_content;
$p->link=get_permalink($post->ID);
$p->label=$post->post_title;
$e->add_item($p);
}
}
function featplug_wp_render($width,$height,$image_enlarging,$template,$max_stories=10,$filter='')
{
$e=new engine(); // start your engines gentelmans
$e->layer("WORDPRESS");
$e->set_output_dimensions($width,$height);
$e->enable_image_enlarging($image_enlarging);
$e->set_maximum_stories($max_stories);
$e->set_template($template);
$e->set_story_lenght(250);
pump_wordpress_data($filter,$e);
echo $e->render();
$e=null; // release resources
}
==== CMSMadeSimple ====
Here's an discussion on Featplug & CMSMadeSimple.
http://forum.cmsmadesimple.org/index.php?topic=28111.msg135093
====== SimplePie & Featplug Integration ======
I'm running feed aggregator sites with Featplug shows embedded. (IE. http://mmofresh.com)
Integrating is quite easy;
function featplug_render_rss($url)
{
$e=new engine(); // init engine
$e->layer("STAND_ALONE"); // layer: Standalone
$e->set_story_lenght(0); // story text lenght
$e->set_output_dimensions(330,190); // output image dimensions
$e->set_thumbnail_dimensions(50,50); // thumbnail dimensions
$e->enable_image_enlarging(True); // enlarge images?
$feed = new SimplePie();
$feed->set_feed_url($url);
$feed->init();
$feed->handle_content_type();
foreach ($feed->get_items() as $item)
{
$p=new post_item();
$p->img=$item->get_content();
$p->label=$item->get_title();
$p->content=$item->get_content();
$p->link=$item->get_permalink();
$e->add_item($p);
}
$e->set_template("smoothgallery"); // slideshow
echo $e->render();
$e=null; // release resources
}
Call: