我想要做的是在我的横幅下面创建一个小部件区域。
以下是一个例子:
以下是我的动作挂钩:http://beasomdesign.com/?g_hooks=show
这是我的functions.php页面:
<?php
//* Start the engine
include_once( get_template_directory() . '/lib/init.php' );
//* Child theme (do not remove)
define( 'CHILD_THEME_NAME', 'Genesis Sample Theme' );
define( 'CHILD_THEME_URL', 'http://www.studiopress.com/' );
define( 'CHILD_THEME_VERSION', '2.0.1' );
//* Enqueue Lato Google font
add_action( 'wp_enqueue_scripts', 'genesis_sample_google_fonts' );
function genesis_sample_google_fonts() {
wp_enqueue_style( 'google-font-lato', '//fonts.googleapis.com/css?family=Lato:300,700', array(), CHILD_THEME_VERSION );
}
//* Add HTML5 markup structure
add_theme_support( 'html5' );
//* Add viewport meta tag for mobile browsers
add_theme_support( 'genesis-responsive-viewport' );
//* Add support for custom background
add_theme_support( 'custom-background' );
//* Add support for 3-column footer widgets
add_theme_support( 'genesis-footer-widgets', 3 );
//* Add HTML5 markup structure
add_theme_support( 'html5' );
/** Register widget areas */
genesis_register_sidebar( array(
'id' => 'tha',
'name' => __( 'Top home Area', 'bd' ),
'description' => __( 'This is the top home area for images.', 'bd' ),
) );
genesis_register_sidebar( array(
'id' => 'spotlight',
'name' => __( ' Middle Content Area', 'bd' ),
'description' => __( 'This is the content area for the homepage.', 'bd' ),
) );
/**
* Add THA widget support for site. If widget not active, don't display
*
*/
add_action( 'genesis_after_header', 'bd_tha_genesis' );
function bd_tha_genesis() {
//** If it's the Home page, display tha*/
if ( is_home() ) {
genesis_widget_area( 'tha', array(
'before' => '<div id="tha">',
'after' => '</div>',
) );
}
}
只要我将以下代码添加到我的functions.php页面,我的网站就会显示为空白。
add_action( 'genesis_before_content', 'bd_spotlight_genesis' );
function bd_spotlight_genesis() {
//** If it's the Home page, display spotlight*/
if ( is_home() ) {
genesis_widget_area( 'spotlight', array(
'before' => '<div id="spotlight">',
'after' => '</div>',
) );
}
我不太清楚php,但我认为我的结构可能已关闭。我做错了什么?