How to add before entry widget in Genesis Child Theme

In this tutorial we will learn, how to add before entry widget in Genesis Child Theme.
It is mine new journey with Genesis Framework.Working and exploring,to make theme on it.In my some posts,I already stated I recently got my premium theme.Before this I played on,already available free Genesis Theme. In my some other sites,I decently used the free Genesis Sample Theme as well.

The themes which I explored,most of it does not have before entry widget.I always prefer the themes,which has widget on header,sidebar,above and below posts and footer area. The reason is,it is easy to put Advertisement and some useful widget at these area.

I have taken the below given code from my own site’s Magazine Pro theme.
In below given code,you can replace word magazine with your theme name

Add the below given code in functions.php file of Genesis Child Theme

Add the below given lines at last end of the functions.php file of the child theme.

//* Register before entry widge
genesis_register_sidebar( array(
	'id'          => 'before-entry',
	'name'        => __( 'Before Entry', 'magazine' ),
	'description' => __( 'before entry section.', 'magazine' ),
) );
 
//* Adding hook in single post
add_action( 'genesis_entry_content', 'sharad_before_entry_widget',9 );
function sharad_before_entry_widget() {
 
	if ( ! is_singular('post' ) )
		return;
 
	genesis_widget_area( 'before-entry', array(
		'before' => '
', 'after' => '
', ) ); }

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.