Php 定义widget区域破坏了我的WP站点
我想做的是在我的横幅下创建一个小部件区域 以下是一个例子: 以下是我的动作挂钩: 以下是my functions.php页面:Php 定义widget区域破坏了我的WP站点,php,wordpress,widget,Php,Wordpress,Widget,我想做的是在我的横幅下创建一个小部件区域 以下是一个例子: 以下是我的动作挂钩: 以下是my 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(
<?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>',
) );
}
}
看起来您在函数声明中缺少了一个右大括号,但这可能不是问题所在,可能只是复制和粘贴?看起来我实际上忘记添加右大括号了。嗯,这是一个简单的解决办法,谢谢!:)
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>',
) );
}