| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
Plugin Name: oik sidebar |
| 5 |
Plugin URI: http://www.oik-plugins.com/oik |
| 6 |
Description: Applies widget wrangler sidebar functionality to Artisteer themes |
| 7 |
Version: 1.4 |
| 8 |
Author: bobbingwide |
| 9 |
Author URI: http://www.bobbingwide.com |
| 10 |
License: GPL2 |
| 11 |
|
| 12 |
Copyright 2011 Bobbing Wide (email : herb@bobbingwide.com ) |
| 13 |
|
| 14 |
This program is free software; you can redistribute it and/or modify |
| 15 |
it under the terms of the GNU General Public License version 2, |
| 16 |
as published by the Free Software Foundation. |
| 17 |
|
| 18 |
You may NOT assume that you can use any other version of the GPL. |
| 19 |
|
| 20 |
This program is distributed in the hope that it will be useful, |
| 21 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 |
GNU General Public License for more details. |
| 24 |
|
| 25 |
The license for this software can likely be found here: |
| 26 |
http://www.gnu.org/licenses/gpl-2.0.html |
| 27 |
|
| 28 |
*/ |
| 29 |
global $oik_options; |
| 30 |
require_once( 'bobbfunc.inc' ); |
| 31 |
|
| 32 |
function oik_sidebar_api_version() { |
| 33 |
return bw_oik_version(); |
| 34 |
} |
| 35 |
|
| 36 |
/* Note: for this plugin to do anything you need to do the following: |
| 37 |
o change your Artisteer theme to call bw_dynamic_sidebar instead of art_dynamic_sidebar |
| 38 |
o install the Widget Wrangler plugin |
| 39 |
o define Widget Wrangler sidebars for each dynamic sidebar you want to control |
| 40 |
o The sidebar names you may use are: |
| 41 |
Artisteer 2.6 |
| 42 |
default_before |
| 43 |
default_after |
| 44 |
secondary_before |
| 45 |
secondary_after |
| 46 |
Artisteer 3 |
| 47 |
as for Artisteer 2.6 plus you can have _before and/or _after versions for the other sidebars: |
| 48 |
o For more information see http://www.bobbingwidewebdevelopment.com/content/how-control-which-widget-appears-particular-page |
| 49 |
*/ |
| 50 |
|
| 51 |
function bw_dynamic_sidebar( $name ) { |
| 52 |
|
| 53 |
global $art_widget_args, $art_sidebars, $theme_sidebars; |
| 54 |
// Add Widget Wrangler sidebars: _before and _after |
| 55 |
// Note: We believe that dynamic_sidebar exists as this was pre-requisite to calling this routine |
| 56 |
// but we can't be sure that widget wrangler is activated so don't call it if it's not. |
| 57 |
|
| 58 |
$wwsb = function_exists( 'ww_dynamic_sidebar' ); |
| 59 |
|
| 60 |
|
| 61 |
bw_trace( $wwsb, __FUNCTION__, __LINE__, __FILE__, 'wwsb' ); |
| 62 |
bw_trace( $name, __FUNCTION__, __LINE__, __FILE__, 'name' ); |
| 63 |
|
| 64 |
if ( $wwsb ) { |
| 65 |
$success_b = ww_dynamic_sidebar($name.'_before'); |
| 66 |
|
| 67 |
bw_trace( $success_b, __FUNCTION__, __LINE__, __FILE__ ); |
| 68 |
|
| 69 |
} |
| 70 |
|
| 71 |
// Note: As of Artisteer version v3.0.0.39952 the global variable is called $theme_sidebars not $art_sidebars |
| 72 |
// use $theme_sidebars if theme_include_lib is defined |
| 73 |
// in previous versions the function was art_include_lib |
| 74 |
|
| 75 |
if ( function_exists( 'theme_include_lib' )) |
| 76 |
$success = dynamic_sidebar($theme_sidebars[$name]['id']); |
| 77 |
else |
| 78 |
$success = dynamic_sidebar($art_sidebars[$name]['id']); |
| 79 |
|
| 80 |
|
| 81 |
if ( $wwsb ) { |
| 82 |
$success_a = ww_dynamic_sidebar($name.'_after'); |
| 83 |
bw_trace( $success_a, __FUNCTION__, __LINE__, __FILE__ ); |
| 84 |
} |
| 85 |
return( $success ); |
| 86 |
} |
| 87 |
|
| 88 |
|