Docs_appliance_core_wordpress

beingzoe edited this page Jan 31, 2011 · 1 revision

Appliance: Marketing: JIT (Just-in-Time) Sidebar

Widget! Drop this widget in your sidebar above the last couple things in a sidebar and they will magically float with the page once they are scrolled to the top. Perfect for important navigation or “promotional” call to action content.


Usage Summary

$my_theme->load('jit_sidebar');

Then just add the widget to the appropriate sidebar just above the items you wish to “float”.


Usage Notes

Requires jQuery. Does not work in IE6.

The script will not trigger the floating if it detects that the height of the items being floated is taller than the height of the current browser viewport. Otherwise there would be content that would never be reachable.


Roadmap Notes

There are issues in certain layouts where the floating JIT sidebar overlaps the site footer in an unattractive way. This will be improved to prevent that from happening.

Clone this wiki locally

Appliance: Core: WordPress

We aren’t trying to reinvent anything, WordPress is great. We just don’t like typing ;)

The ‘wordpress’ appliance adds some ninja awesome methods to further speed up and DRY up your code. If you think of anything else that would rock in here fork the project and send me a pull request! Or at least let me know what you would like to see ;)


Usage Summary


$my_kitchen->load('wordpress');
$my_kitchen->wordpress->->registerSidebar('Blog Sidebar', 'Sidebar content for blog articles');


Method Reference

  • registerSidebar()
  • dynamicSidebar()
  • registerSidebars()
  • dynamicSidebars()


registerSidebar($name, $description, $args = NULL )

Works just like the WordPress function register_sidebar() with a whole lot less typing and clutter. Use dynamicSidebar() to output sidebars created using registerSidebar()


$my_theme->wordpress->registerSidebar('Pages Sidebar', 'Sidebar content for pages');
$GLOBALS["my_theme"]->wordpress->dynamicSidebar('Pages Sidebar');

For now just look at the docblock:


/**
 * WP replacement for
 * register_sidebar
 *
 * Defaults are HTML5 semantic awesome so you should never need to use the args
 * A little CSS goes a long way ;)
 *
 * @since       0.1
 * @access      public
 * @see         KST_Wordpress::dynamicSidebar
 * @uses        register_sidebar() WP function
 * @param       required string $name
 * @param       required string $description
 * @param       optional array  $args send any of the arguments for WP register_sidebar()
 *                  optional string $id defaults to $name
 *                  optional string $before_widget
 *                  optional string $after_widget
 *                  optional string $before_title
 *                  optional string $after_title
 * @return      string id that was registered
 * @todo        $context to allow for automagic conditonal output
*/


dynamicSidebar($name)

Use to output sidebars created with registerSidebar():


$my_theme->wordpress->registerSidebar('Pages Sidebar', 'Sidebar content for pages');
$GLOBALS["my_theme"]->wordpress->dynamicSidebar('Pages Sidebar');

For now just look at the docblock:


/**
 * WP replacement for
 * dynamic_sidebar
 *
 * Echoes output
 *
 * @since       0.1
 * @see         KST_Wordpress::registerSidebar
 * @access      public
 * @uses        register_sidebar() WP function
 * @param       required string $name
 * @todo        consider not having any default or a flag to turn that shit off
*/


registerSidebars($how_many, $name, $args = NULL)

Works just like registerSidebars() but outputs MULTIPLE CONSECUTIVE sidebars (like 3 across the footer anyone?)


$my_theme->wordpress->registerSidebars(3, 'Footer Area');
$GLOBALS["my_theme"]->wordpress->dynamicSidebars('footer_area_3');

For now just look at the docblock:


/**
 * WP enhanced replacement for
 * register_sidebars (multiple CONSECUTIVE NAMED with shared description)
 *
 * N.B. Unlike registerSidebar() the $description param DOES NOT EXIST and must
 *      be sent in the $args if you want to customize it
 *
 * N.B. Unlike registerSidebar() an $id is created for the entire GROUP of sidebars
 *      from the $name param. Underscored_with_how_many (see usage above).
 *      And if you think you'll forget the method returns that so you pin it on your wall.
 *
 * N.B. Remember: As in floating next to each other or one after the other
 * If you are just lazy and don't need multiple sidebars named CONSECUTIVLEY
 * then just use the built-in WP function register_sidebars() and dynamic_sidebar
 * the traditional way with the WP API
 *
 * @since       0.1
 * @access      public
 * @see         KST_Wordpress::dynamicSidebars
 * @uses        register_sidebar() WP function
 * @param       required int    $how_many The number of consecutive sidebars to create
 * @param       required string $name
 * @param       optional array  $args send any of the arguments for WP register_sidebar()
 *                  optional string $description
 *                  optional string $id defaults to $name
 *                  optional string $before_widget
 *                  optional string $after_widget
 *                  optional string $before_title
 *                  optional string $after_title
 * @return      string id that was registered
 * @todo        sprint the description so they could add their own custom counter message like the default
*/


dynamicSidebars($id)

Use to output MULTIPLE CONSECUTIVE sidebars created with registerSidebars()


$my_theme->wordpress->registerSidebar('Pages Sidebar', 'Sidebar content for pages');
$GLOBALS["my_theme"]->wordpress->dynamicSidebar('Pages Sidebar');

For now just look at the docblock:


/**
 * WP enhancement for
 * automagically outputting multiple CONSECUTIVE dynamic_sidebars
 *
 * As in floating next to each other or one after the other
 * If you are just lazy and don't need multiple sidebars named CONSECUTIVLEY
 * then just use the built-in WP function register_sidebars() and dynamic_sidebar
 * the traditional way with the WP API
 *
 * For outputting NAMED CONSECUTIVE registered sidebars quickly
 *
 * Echoes output
 *
 * @since       0.1
 * @see         KST_Wordpress::registerSidebars
 * @access      public
 * @uses        register_sidebar() WP function
 * @param       required string $name
*/