init commit
This commit is contained in:
83
inc/widgets/mt-widget-functions.php
Normal file
83
inc/widgets/mt-widget-functions.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* custom function and work related to widgets.
|
||||
*
|
||||
* @package Sophia After Dark
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register widget area.
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
|
||||
*/
|
||||
function sophia_after_dark_widgets_init() {
|
||||
/**
|
||||
* Register default sidebar
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
register_sidebar( array(
|
||||
'name' => esc_html__( 'Sidebar', 'sophia-after-dark' ),
|
||||
'id' => 'sidebar-1',
|
||||
'description' => esc_html__( 'Add widgets here.', 'sophia-after-dark' ),
|
||||
|
||||
'before_widget' => '<section id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</section>',
|
||||
'before_title' => '<h4 class="widget-title">',
|
||||
'after_title' => '</h4>',
|
||||
) );
|
||||
|
||||
/**
|
||||
* Register Header Ads Section
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
register_sidebar( array(
|
||||
'name' => esc_html__( 'Header Ads Section', 'sophia-after-dark' ),
|
||||
'id' => 'header-ads-section',
|
||||
'description' => esc_html__( 'Add MT: Ads Banner widgets here.', 'sophia-after-dark' ),
|
||||
|
||||
'before_widget' => '<section id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</section>',
|
||||
'before_title' => '<h4 class="widget-title">',
|
||||
'after_title' => '</h4>',
|
||||
) );
|
||||
|
||||
/**
|
||||
* Register 4 different footer area
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
register_sidebars( 4 , array(
|
||||
'name' => esc_html__( 'Footer %d', 'sophia-after-dark' ),
|
||||
'id' => 'footer-sidebar',
|
||||
'description' => esc_html__( 'Added widgets are display at Footer Widget Area.', 'sophia-after-dark' ),
|
||||
'before_widget' => '<section id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</section>',
|
||||
'before_title' => '<h4 class="widget-title">',
|
||||
'after_title' => '</h4>',
|
||||
) );
|
||||
|
||||
// Author Info
|
||||
register_widget( 'sophia_after_dark_Author_Info' );
|
||||
|
||||
// Latest Posts
|
||||
register_widget( 'sophia_after_dark_Latest_Posts' );
|
||||
|
||||
//Social Media
|
||||
register_widget( 'sophia_after_dark_Social_Media' );
|
||||
}
|
||||
add_action( 'widgets_init', 'sophia_after_dark_widgets_init' );
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Load widget required files
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
require get_template_directory() . '/inc/widgets/mt-widget-fields.php'; // Widget fields
|
||||
require get_template_directory() . '/inc/widgets/mt-author-info.php'; // Author Info
|
||||
require get_template_directory() . '/inc/widgets/mt-latest-posts.php'; // Latest Posts
|
||||
require get_template_directory() . '/inc/widgets/mt-social-media.php'; // Social Media
|
Reference in New Issue
Block a user