Table of Contents

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 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

  1. After installing the plugin and activating, goto Wordpress Dashboard ~ Design ~ Widgets.
  2. On the left, find the FeatPlug widget and press Add.
  3. On the right side, find the new added widget and press Edit.
  4. You'll see a screen similar to this;

Configure the options;

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() - 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:

Example Code:

<?php 
if (function_exists('featplug_wp_render')): 
 featplug_wp_render(525,290,True,'smoothgallery',10,'numberposts=10');
endif; 
?>

This example;



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:

Example Code:

<?php 
if (function_exists('featplug_wp_render_slideshow')): 
 featplug_wp_render_slideshow(300,100,False,5,'numberposts=15&orderby=rand');
endif; 
?>

This example;



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:

Example Code:

<?php 
if (function_exists('featplug_wp_render_banners')): 
 featplug_wp_render_banners(450,200,False,3,'numberposts=5');
endif; 
?>

This example;



Output Templates

It's quite easy to create your own template with FeatPlug. Also by default it comes with pre-defined templates;


WP-Post-Banners 0.5 preview - Slideshow feature from raistlinthewiz on Vimeo.

www.huseyinuslu.net_wp-content_uploads_2008_08_wpb05-222x300.jpg

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 Wordpress-MU based installation) and put plugin call in your theme.

Here's a 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 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="<img src='http://fc07.deviantart.com/fs14/f/2007/005/e/0/The_Simpsonzu_by_spacecoyote.jpg'>";
	$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="<img src='http://fc03.deviantart.com/fs31/f/2008/204/d/9/d962113e73c4ea06ef8bac44b0eb93e3.jpg'>";
	$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:

<?php featplug_render_rss("http://www.massively.com/category/wallpapers/rss.xml"); ?>