Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Add Genesis Widget to the End of the_content()
<?php
//* New Widget
genesis_register_sidebar( array(
'id' => 'after-blog-content',
'name' => __( 'After Blog Content', 'hello-pro' ),
'description' => __( 'Description of the widget goes here', 'hello-pro' ),
) );
//* Add widget after the_content()
function add_widget_after_blog_content($content) {
if ( is_singular( 'post' ) ) {
if ( is_active_sidebar( 'after-blog-content' ) {
$aftercontentwidget = genesis_widget_area( 'after-blog-content', array(
'before' => '<div class="after-blog-widget"><div class="wrap">',
'after' => '</div></div>',
) );
}
$modified_content = $content . $aftercontentwidget;
return $modified_content;
}
}
add_filter('the_content', 'add_widget_after_blog_content');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment