php 设置主题功能
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 设置主题功能相关的知识,希望对你有一定的参考价值。
//Enable custom logo in customizer
add_theme_support('custom-logo', array(
'height' => 103,//retina
'width' => 170, //retina 85
'flex-width' => false, //Active crop
));
// Register wp_nav_menu() menus
// http://codex.wordpress.org/Function_Reference/register_nav_menus
register_nav_menus([
'primary_navigation' => __('Primary Navigation', 'sage'),
'secondary_navigation' => __('Secondary Navigation', 'sage')
]);
// Add image size in dropdown Media Library
function my_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'bio' => __( 'Image carre 800*800' ),
'logo_footer' => __( 'Logo pied de page 900 largeur retina' ),
) );
}
add_filter( 'image_size_names_choose', 'my_custom_sizes' );
// Add image size
add_image_size( 'bio', 800, 800, true ); // 300 pixels wide (and unlimited height)
add_image_size( 'logo_footer', 900, false ); // 450 pixels wide (and unlimited height)
/**
* Register sidebars
*/
function widgets_init() {
register_sidebar([
'name' => __('Primary', 'sage'),
'id' => 'sidebar-primary',
'before_widget' => '<section class="widget %1$s %2$s">',
'after_widget' => '</section>',
'before_title' => '<h3>',
'after_title' => '</h3>'
]);
register_sidebar([
'name' => __('Footer', 'sage'),
'id' => 'sidebar-footer',
'before_widget' => '<section class="widget %1$s %2$s">',
'after_widget' => '</section>',
'before_title' => '<h3>',
'after_title' => '</h3>'
]);
}
add_action('widgets_init', __NAMESPACE__ . '\\widgets_init');
以上是关于php 设置主题功能的主要内容,如果未能解决你的问题,请参考以下文章
WordPress主题开发:设置和获取浏览次数
如何从功能,PHP设置WooCommerce通知?
主题动作挂钩一次性功能
WordPress主题开发:产品展示实例
wordpress主题之后台菜单编辑功能
php 儿童主题的Wordpres功能