Last active
August 29, 2022 04:39
-
-
Save alexmustin/fae146fe59b3b229354a9fea62a4875d to your computer and use it in GitHub Desktop.
Add Genesis Widget to the End of the_content()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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