Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //widget space direct after content//
- //example sidebar code//
- register_sidebar(array(
- 'name' => 'Content Widget Area',
- 'id' => 'content-widget',
- 'description' => 'a widget area direct after the content',
- 'before_widget' => '<li class="content-widget" id="%1$s">',
- 'after_widget' => '</li>',
- 'before_title' => '<h2>',
- 'after_title' => '</h2>' ));
- add_filter('the_content','after_content_widget_space',20); //adjust the number for priority
- function after_content_widget_space( $content ) {
- $sidebar = '';
- ob_start();
- if ( is_single() && is_active_sidebar( 'content-widget' ) ) :
- $sidebar = '<ul class="content-widget-space">';
- if ( !dynamic_sidebar( 'content-widget' ) ) : endif;
- $sidebar .= ob_get_contents();
- $sidebar .= '</ul>';
- endif;
- ob_end_clean();
- return $content . $sidebar;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement