Sticky Posts
Apr 23, 2009
Theme Plugins Management System - Foreplay Video
Don't have time to write / explain this whole post right now but this is a taste of it. Check this movie out. This one goes out to Sugarrae and other ocasional plugin writers. It has almost no comments attached. Observe possibilities and keep in touch as I'm writing the PDF manual ... in a day or two.
To cut things short this is an alternative plugin management system especially designed for plugins that are made to run only with certain themes. I needed a way to separate general use plugins from theme plugins as things were getting crowded and out of control ... and came up with this.
It's like ... the shit!
You design plugins the same way you do for general use plugins, 4 function names need to change. That's it. And you can share theme plugins with others, it's awesome... and the functions.php file will loose a lot of fat. You will be able to activate / deactivate you theme plugins, thing you could not do without actually editing stuff inside functions.php.
Theme plugin writers, theme developers ... get ready!
Stunning Footage Never Seen Before!
Make sure you see this in full screen mode. There's a tiny button right at the end of the white progress bar. Don't ask my why it's so tiny. I'm too tired to tell right now!
And The 5upport Theme Plugin:
<?php
/*
Plugin Name: 5upport
Plugin URI: http://blog.5ubliminal.com/topics/wordpress/plugins/
Description: 5upport will add/remove a link to blog.5ubliminal.com on activate/deactivate.
Version: 5.U.B
Author: 5ubliminal
Author URI: http://blog.5ubliminal.com/
Support URI: http://blog.5ubliminal.com/support/
*/
//-----------------------------------------------------------------------------
// Change this to nofollow if you wish
define('THEMEPLUG_5UPPORT_REL', "external");
// Change this as you wish
define('THEMEPLUG_5UPPORT_TITLE', "5ubliminal's 5pace");
// Don't change this ... it's the whole point of this plugin
define('THEMEPLUG_5UPPORT_URL', "http://blog.5ubliminal.com/");
// Open in new link. Use _top to open in current window
define('THEMEPLUG_5UPPORT_TARGET', "_blank");
// Change or empty this
define('THEMEPLUG_5UPPORT_EXCERPT', "5ubliminal's 5pace - Blackhat SEO & Coding Blog");
//-----------------------------------------------------------------------------
// Part of 5ubliminal's PHP ELIB
if(!function_exists('el_wp_injectBlogRoll')){
function el_wp_injectBlogRoll( $link, $title, $params = null ){
if(!isset($GLOBALS['wpdb']) || !function_exists('wp_insert_link')) return false;
global $wpdb; if($wpdb->get_var("SELECT COUNT(link_id) FROM {$wpdb->links}
WHERE link_url = '".mysql_escape_string($link)."' LIMIT 1")) return true;
if(!is_array($params)) $params = array();
$blog_roll_link = array( 'link_name' => $title, 'link_url' => $link);
$blog_roll_link = array_merge($params, $blog_roll_link);
wp_insert_link($blog_roll_link); return true;
}
function el_wp_ejectBlogRoll( $link ){
if(!isset($GLOBALS['wpdb']) || !function_exists('wp_delete_link')) return false;
global $wpdb; $link_id = (int)$wpdb->get_var("SELECT link_id FROM {$wpdb->links}
WHERE link_url = '".mysql_escape_string($link)."' LIMIT 1");
if(!$link_id) return true; wp_delete_link($link_id); return true;
}
}
//-----------------------------------------------------------------------------
// This adds the link to the default blogroll
function _5ubTheme_5upport_Activate(){
if(!function_exists('el_wp_injectBlogRoll')) return;
el_wp_injectBlogRoll(
THEMEPLUG_5UPPORT_URL, THEMEPLUG_5UPPORT_TITLE,
array( // More settings
'link_rel' => THEMEPLUG_5UPPORT_REL,
'link_target' => THEMEPLUG_5UPPORT_TARGET,
'link_description' => THEMEPLUG_5UPPORT_EXCERPT,
)
);
}
register_activation_callback(__FILE__, '_5ubTheme_5upport_Activate');
//-----------------------------------------------------------------------------
// This removes the link from the default blogroll
function _5ubTheme_5upport_Deactivate(){
if(!function_exists('el_wp_ejectBlogRoll')) return;
el_wp_ejectBlogRoll(THEMEPLUG_5UPPORT_URL);
}
// !!! Instead of register_deactivation_hook I used the below... eZ!
register_deactivation_callback(__FILE__, '_5ubTheme_5upport_Deactivate');
//-----------------------------------------------------------------------------
/* THANKS! for your 5upport */
//-----------------------------------------------------------------------------
?>
Looks like a regular plugin but it goes inside the theme folder. God ... this rules!
Cheers!


AWESOME!