Skip to content

Instantly share code, notes, and snippets.

@seothemes
Created June 17, 2018 04:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seothemes/2a91f9231fc4f360083c35de81635e92 to your computer and use it in GitHub Desktop.
Save seothemes/2a91f9231fc4f360083c35de81635e92 to your computer and use it in GitHub Desktop.
Widget area shortcode
<?php
// Do NOT include the opening php tag shown above. Copy the code shown below.
add_shortcode( 'widget_area', 'prefix_widget_area_shortcode' );
/**
* Display widget area with shortcode.
*
* @since 1.0.0
*
* @return string
*/
function prefix_widget_area_shortcode( $atts ) {
$atts = shortcode_atts(
array(
'id' => '',
),
$atts,
'widget_area'
);
ob_start();
genesis_widget_area( $atts['id'], array(
'before' => '<div class="' . $atts['id'] . ' widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
return ob_get_clean();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment