douzhaolu4780 2013-08-11 22:21
浏览 214
已采纳

如何使用WordPress自定义($ wp_customize)更改图像?

I have the following code below, but I can't figure out why it's not working. All I get from my template is a blank screen. Any ideas? I'm using the latest version of WordPress.

function twentyone_customizer_register($wp_customize)
{
    $wp_customize->add_section('logo_changer', array(
        'title'       => __('Images', 'twentyone'),
        'description' => 'Change index page background image.'
    ));

    $wp_customize->add_setting('logo_image', array(
        'default' => 'http://localhost/twentyone/wp-content/themes/twentyone/assets/img/showcase.jpg'
    ));

    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo_image', array(
        'label'    => __('Edit Showcase Image', 'twentyone'),
        'section'  => 'logo_changer',
        'settings' => 'logo_image'
    )));
}
add_action('customize_register', 'twentyone_customizer_register');
  • 写回答

1条回答 默认 最新

  • duangu9666 2013-08-11 22:31
    关注

    I've solved my problem and I have edited the code to reflect the changes. I named the function starting with a number and that caused the theme customizer not to work.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿