如何在自定义帖子

时间:2017-10-29 15:38:24

标签: wordpress wordpress-theming custom-wordpress-pages wordpress-rest-api

如何创建该选项,请参阅this image 在我的自定义主题? 我可以使用自定义帖子制作主题,但我想使网站与此图像类似。 谢谢。

1 个答案:

答案 0 :(得分:0)

图片中显示的项目是' Customizer Sections'并通过自定义程序API添加。你可以使用这样的代码来添加一个部分。 注意:您还需要添加设置和控件。

<?php
function mytheme_customize_register( $wp_customize ) {
    //All our sections, settings, and controls will be added here
    $wp_customize->add_section( 'mytheme_new_section_slider' , array(
        'title'      => __( 'Slider Settings', 'mytheme' ),
        'priority'   => 30,
    ) );
    // you would also have settings and controls that are added to the section.
    // if you add a section and it contains no controls it will not appear.
}
add_action( 'customize_register', 'mytheme_customize_register' );

以下是add_section方法的一些文档:https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/add_section

有些关于整个过程,包括添加设置和控件:https://codex.wordpress.org/Theme_Customization_API

相关问题