个性化阅读
专注于IT技术分析

如何在自定义帖子中添加wordpress自定义seciton

点击下载

如何创建该选项, 请在我的自定义主题上看到此图像?我可以使用自定义帖子来制作主题, 但是我想使网站类似于该图片。谢谢。


#1


图像中显示的项目是”定制程序部分”, 并通过定制程序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

赞(0)
未经允许不得转载:srcmini » 如何在自定义帖子中添加wordpress自定义seciton

评论 抢沙发

评论前必须登录!