芝麻web文件管理V1.00
编辑当前文件:/home/r5772835/public_html/dina.ycreate.jp/wp-content/themes/snow-monkey/app/setup/widget-area.php
__( 'Sidebar', 'snow-monkey' ), 'description' => __( 'These widgets are displayed in the sidebar on posts and pages.', 'snow-monkey' ), 'id' => 'sidebar-widget-area', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); } ); /** * Add sidebar sticky widget area * * @return void */ add_action( 'widgets_init', function() { register_sidebar( array( 'name' => __( 'Sticky sidebar', 'snow-monkey' ), 'description' => __( 'These widgets are displayed in the sidebar on posts and pages.', 'snow-monkey' ), 'id' => 'sidebar-sticky-widget-area', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); } ); /** * Add top of page title widget area * * @return void */ add_action( 'widgets_init', function() { register_sidebar( array( 'name' => __( 'Top of the page title', 'snow-monkey' ), 'description' => __( 'These widgets are displayed on the page title on the posts and pages.', 'snow-monkey' ), 'id' => 'title-top-widget-area', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); } ); /** * Add top of archive page widget area * * @return void */ add_action( 'widgets_init', function() { register_sidebar( array( 'name' => __( 'Top of the archive page', 'snow-monkey' ), 'description' => __( 'These widgets are displayed top of the contents on archive page.', 'snow-monkey' ), 'id' => 'archive-top-widget-area', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); } ); /** * Add bottom of contents widget area * * @return void */ add_action( 'widgets_init', function() { register_sidebar( array( 'name' => __( 'Bottom of contents', 'snow-monkey' ), 'description' => __( 'These widgets are displayed bottom of the contents on posts and pages.', 'snow-monkey' ), 'id' => 'contents-bottom-widget-area', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); } ); /** * Add sidebar widget area * * @return void */ add_action( 'widgets_init', function() { register_sidebar( array( 'name' => __( 'Archive sidebar', 'snow-monkey' ), 'id' => 'archive-sidebar-widget-area', 'description' => __( 'These widgets are displayed in the sidebar on archive page.', 'snow-monkey' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); } ); /** * Add front page widget area * * @return void */ add_action( 'widgets_init', function() { register_sidebar( array( 'name' => __( 'Homepage (Top of page)', 'snow-monkey' ), 'id' => 'front-page-top-widget-area', 'description' => __( 'These widgets are displayed in the homepage.', 'snow-monkey' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); add_filter( 'dynamic_sidebar_params', function( $params ) { if ( 'front-page-top-widget-area' !== $params[0]['id'] ) { return $params; } $wp_page_template = get_post_meta( get_the_ID(), '_wp_page_template', true ); if ( ! $wp_page_template || 'default' === $wp_page_template || false !== strpos( $wp_page_template, 'one-column-full.php' ) ) { $params[0]['before_widget'] .= '
'; $params[0]['after_widget'] .= '
'; } return $params; } ); } ); /** * Add front page widget area * * @return void */ add_action( 'widgets_init', function() { register_sidebar( array( 'name' => __( 'Homepage (Bottom of page)', 'snow-monkey' ), 'id' => 'front-page-bottom-widget-area', 'description' => __( 'These widgets are displayed in the homepage.', 'snow-monkey' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); add_filter( 'dynamic_sidebar_params', function( $params ) { if ( 'front-page-bottom-widget-area' !== $params[0]['id'] ) { return $params; } $wp_page_template = get_post_meta( get_the_ID(), '_wp_page_template', true ); if ( ! $wp_page_template || 'default' === $wp_page_template || false !== strpos( $wp_page_template, 'one-column-full.php' ) ) { $params[0]['before_widget'] .= '
'; $params[0]['after_widget'] .= '
'; } return $params; } ); } ); /** * Add home page widget area * * @return void */ add_action( 'widgets_init', function() { register_sidebar( array( 'name' => __( 'Posts page (Top of page)', 'snow-monkey' ), 'id' => 'posts-page-top-widget-area', 'description' => __( 'These widgets are displayed in the posts page.', 'snow-monkey' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); add_filter( 'dynamic_sidebar_params', function( $params ) { if ( 'posts-page-top-widget-area' !== $params[0]['id'] ) { return $params; } $wp_page_template = get_theme_mod( 'archive-post-layout' ); if ( ! $wp_page_template || 'default' === $wp_page_template || false !== strpos( $wp_page_template, 'one-column-full.php' ) ) { $params[0]['before_widget'] .= '
'; $params[0]['after_widget'] .= '
'; } return $params; } ); } ); /** * Add home page widget area * * @return void */ add_action( 'widgets_init', function() { register_sidebar( array( 'name' => __( 'Posts page (Bottom of page)', 'snow-monkey' ), 'id' => 'posts-page-bottom-widget-area', 'description' => __( 'These widgets are displayed in the posts page.', 'snow-monkey' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); add_filter( 'dynamic_sidebar_params', function( $params ) { if ( 'posts-page-bottom-widget-area' !== $params[0]['id'] ) { return $params; } $wp_page_template = get_theme_mod( 'archive-post-layout' ); if ( ! $wp_page_template || 'default' === $wp_page_template || false !== strpos( $wp_page_template, 'one-column-full.php' ) ) { $params[0]['before_widget'] .= '
'; $params[0]['after_widget'] .= '
'; } return $params; } ); } ); /** * Add footer widget area * * @return void */ add_action( 'widgets_init', function() { register_sidebar( array( 'name' => __( 'Footer', 'snow-monkey' ), 'id' => 'footer-widget-area', 'description' => __( 'These widgets are displayed in the footer.', 'snow-monkey' ), 'before_widget' => '', 'before_title' => '
', 'after_title' => '
', ) ); } ); /** * Add overlay widget area * * @return void */ add_action( 'widgets_init', function() { register_sidebar( array( 'name' => __( 'Overlay', 'snow-monkey' ), 'id' => 'overlay-widget-area', 'description' => __( 'These widgets are displayed in the overlay that opens with clicking #sm-overlay-widget-area.', 'snow-monkey' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); } ); /** * Add top of article widget area * * @return void */ add_action( 'widgets_init', function() { register_sidebar( array( 'name' => __( 'Top of the article', 'snow-monkey' ), 'description' => __( 'These widgets are displayed top of the article on posts and pages.', 'snow-monkey' ), 'id' => 'article-top-widget-area', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); } ); /** * Add bottom of article widget area * * @return void */ add_action( 'widgets_init', function() { register_sidebar( array( 'name' => __( 'Bottom of the article', 'snow-monkey' ), 'description' => __( 'These widgets are displayed bottom of the article on posts and pages.', 'snow-monkey' ), 'id' => 'article-bottom-widget-area', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); } ); /** * Enqueue scripts * * @return void */ add_action( 'wp_enqueue_scripts', function() { wp_enqueue_script( Helper::get_main_script_handle() . '-widgets', get_theme_file_uri( '/assets/js/widgets.js' ), array(), filemtime( get_theme_file_path( '/assets/js/widgets.js' ) ), true ); if ( Helper::is_active_sidebar( 'sidebar-sticky-widget-area' ) ) { wp_enqueue_script( Helper::get_main_script_handle() . '-sidebar-sticky-widget-area', get_theme_file_uri( '/assets/js/sidebar-sticky-widget-area.js' ), array(), filemtime( get_theme_file_path( '/assets/js/sidebar-sticky-widget-area.js' ) ), true ); } } );