【发布时间】:2016-05-24 05:06:11
【问题描述】:
嘿,我对 php 和 wordpress 开发有点陌生,我只是在尝试 wordpress 的工作方式和主题的工作方式。现在我已经尝试多次查找这个但没有帮助。这总是一些不同的东西,对那些人有用的东西,对我没用。这是代码,
<?php
function sandor_hero_cap() {
$wp_customize->add_section('sandor_subhead_title', array(
'title' => __('Sub-Header', 'sandor'),
));
$wp_customize->add_setting('sandor_subhead_title', array(
'default' => 'A Virtual PLAYGROUND',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('sandor_subhead_title', array(
'label' => __('Sub-Header Title', 'sandor'),
'section' => 'sandor_subhead_section',
'priority' => 5,
'settings' => 'sandor_subhead_title'
));
}
add_action( 'customize_register', 'sandor_hero_cap' );
?>
我得到的错误是:
Call to a member function add_section() on a non-object in functions.php line 5
我已经尝试了很多东西,但似乎没有任何效果,希望你们能帮助我解决这个问题。谢谢:)
【问题讨论】: