Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Add "first" and "last" CSS classes to dynamic sidebar widgets. Also adds numeric index class for each widget (widget-1, widget-2, etc.)
*/
function hip_widget_first_last_classes( $params ) {
global $my_widget_num; // Global a counter array
$this_id = $params[0]['id']; // Get the id for the current sidebar we're processing
$arr_registered_widgets = wp_get_sidebars_widgets(); // Get an array of ALL registered widgets
@chadmohr
chadmohr / widget nav.php
Created February 16, 2012 15:47 — forked from billerickson/widget nav.php
Genesis widget area next to nav
<?php
add_filter( 'genesis_nav_items', 'sws_social_icons', 10, 2 );
add_filter( 'wp_nav_menu_items', 'sws_social_icons', 10, 2 );
function sws_social_icons($menu, $args) {
$args = (array)$args;
if ( 'primary' !== $args['theme_location'] )
return $menu;
ob_start();
@chadmohr
chadmohr / widget nav
Created February 10, 2012 04:25
Genesis widget area next to nav
<?php
add_filter( 'genesis_nav_items', 'sws_social_icons', 10, 2 );
add_filter( 'wp_nav_menu_items', 'sws_social_icons', 10, 2 );
function sws_social_icons($menu, $args) {
$args = (array)$args;
if ( 'primary' !== $args['theme_location'] )
return $menu;
$social = dynamic_sidebar('Social Menu');
@chadmohr
chadmohr / widget nav
Created February 10, 2012 04:21
Genesis widget area next to nav
<?php
add_filter( 'genesis_nav_items', 'sws_social_icons', 10, 2 );
add_filter( 'wp_nav_menu_items', 'sws_social_icons', 10, 2 );
function sws_social_icons($menu, $args) {
$args = (array)$args;
if ( 'primary' !== $args['theme_location'] )
return $menu;
$social = dynamic_sidebar('Social Menu');