我有一个Genesis儿童主题,我正在努力(here's my test site),我似乎无法弄清楚如何在帖子上方注册一个小部件区域 . 我看到很多教程(like this one)展示了如何添加一个跨越两个列(帖子和侧边栏)的教程,但我希望有一个只在帖子之上,而不是侧边栏 .

看看these hooks,我相信它会出现在genesis_before_loop的钩子里 . 我尝试调整我链接到的教程中的代码,但它没有成功 . 有没有人有更好的教程的代码或链接?

这是我试图使用的代码,但它不起作用:

/**
* Add widget above posts.
*/

//* Add widget above posts 
add_action( 'genesis_loop’, ‘above_posts’ );
function above_posts() {
 
    if (is_active_sidebar( ‘aboveposts’ )) {
        genesis_widget_area( ‘aboveposts’, array(
            'before' => '<div class=“aboveposts widget-area"><div class="wrap"',
            'after' => '</div></div>'
            ) );
    }
}

//* Register widget above posts areas
genesis_register_sidebar( array(
    'id' 			=> ‘aboveposts’,
    'name' 			=> __( ‘Above Posts’ ),
    'description' 	=> __( 'This is the above posts widget.’ ),
) );