Skip to content

Instantly share code, notes, and snippets.

@alexmustin
Last active August 29, 2022 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexmustin/fae146fe59b3b229354a9fea62a4875d to your computer and use it in GitHub Desktop.
Save alexmustin/fae146fe59b3b229354a9fea62a4875d to your computer and use it in GitHub Desktop.
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