我有一个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.’ ),
) );
&#13;