esc_html__( 'Right Sidebar', 'colormag' ), 'id' => 'colormag_right_sidebar', 'description' => esc_html__( 'Shows widgets at Right side.', 'colormag' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Registering main left sidebar register_sidebar( array( 'name' => esc_html__( 'Left Sidebar', 'colormag' ), 'id' => 'colormag_left_sidebar', 'description' => esc_html__( 'Shows widgets at Left side.', 'colormag' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Registering Header sidebar register_sidebar( array( 'name' => esc_html__( 'Header Sidebar', 'colormag' ), 'id' => 'colormag_header_sidebar', 'description' => esc_html__( 'Shows widgets in header section just above the main navigation menu.', 'colormag' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering the Front Page: Slider Area Sidebar register_sidebar( array( 'name' => esc_html__( 'Front Page: Slider Area', 'colormag' ), 'id' => 'colormag_front_page_slider_area', 'description' => esc_html__( 'Show widget just below menu. Suitable for TG: Featured Category Slider.', 'colormag' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); // registering the Front Page: Area beside slider Sidebar register_sidebar( array( 'name' => esc_html__( 'Front Page: Area beside slider', 'colormag' ), 'id' => 'colormag_front_page_area_beside_slider', 'description' => esc_html__( 'Show widget beside the slider. Suitable for TG: Highlighted Posts.', 'colormag' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); // registering the Front Page: Content Top Section Sidebar register_sidebar( array( 'name' => esc_html__( 'Front Page: Content Top Section', 'colormag' ), 'id' => 'colormag_front_page_content_top_section', 'description' => esc_html__( 'Content Top Section', 'colormag' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); // registering the Front Page: Content Middle Left Section Sidebar register_sidebar( array( 'name' => esc_html__( 'Front Page: Content Middle Left Section', 'colormag' ), 'id' => 'colormag_front_page_content_middle_left_section', 'description' => esc_html__( 'Content Middle Left Section', 'colormag' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); // registering the Front Page: Content Middle Right Section Sidebar register_sidebar( array( 'name' => esc_html__( 'Front Page: Content Middle Right Section', 'colormag' ), 'id' => 'colormag_front_page_content_middle_right_section', 'description' => esc_html__( 'Content Middle Right Section', 'colormag' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); // registering the Front Page: Content Bottom Section Sidebar register_sidebar( array( 'name' => esc_html__( 'Front Page: Content Bottom Section', 'colormag' ), 'id' => 'colormag_front_page_content_bottom_section', 'description' => esc_html__( 'Content Bottom Section', 'colormag' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); // Registering contact Page sidebar register_sidebar( array( 'name' => esc_html__( 'Contact Page Sidebar', 'colormag' ), 'id' => 'colormag_contact_page_sidebar', 'description' => esc_html__( 'Shows widgets on Contact Page Template.', 'colormag' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Registering Error 404 Page sidebar register_sidebar( array( 'name' => esc_html__( 'Error 404 Page Sidebar', 'colormag' ), 'id' => 'colormag_error_404_page_sidebar', 'description' => esc_html__( 'Shows widgets on Error 404 page.', 'colormag' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Registering advertisement above footer sidebar register_sidebar( array( 'name' => esc_html__( 'Advertisement Above The Footer', 'colormag' ), 'id' => 'colormag_advertisement_above_the_footer_sidebar', 'description' => esc_html__( 'Shows widgets just above the footer, suitable for TG: 728x90 Advertisement widget.', 'colormag' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Registering footer sidebar one register_sidebar( array( 'name' => esc_html__( 'Footer Sidebar One', 'colormag' ), 'id' => 'colormag_footer_sidebar_one', 'description' => esc_html__( 'Shows widgets at footer sidebar one.', 'colormag' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Registering footer sidebar two register_sidebar( array( 'name' => esc_html__( 'Footer Sidebar Two', 'colormag' ), 'id' => 'colormag_footer_sidebar_two', 'description' => esc_html__( 'Shows widgets at footer sidebar two.', 'colormag' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Registering footer sidebar three register_sidebar( array( 'name' => esc_html__( 'Footer Sidebar Three', 'colormag' ), 'id' => 'colormag_footer_sidebar_three', 'description' => esc_html__( 'Shows widgets at footer sidebar three.', 'colormag' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Registering footer sidebar four register_sidebar( array( 'name' => esc_html__( 'Footer Sidebar Four', 'colormag' ), 'id' => 'colormag_footer_sidebar_four', 'description' => esc_html__( 'Shows widgets at footer sidebar four.', 'colormag' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_widget( "colormag_featured_posts_slider_widget" ); register_widget( "colormag_highlighted_posts_widget" ); register_widget( "colormag_featured_posts_widget" ); register_widget( "colormag_featured_posts_vertical_widget" ); register_widget( "colormag_728x90_advertisement_widget" ); register_widget( "colormag_300x250_advertisement_widget" ); register_widget( "colormag_125x125_advertisement_widget" ); } /* * ************************************************************************************* */ /** * Featured Posts widget */ class colormag_featured_posts_slider_widget extends WP_Widget { function __construct() { $widget_ops = array( 'classname' => 'widget_featured_slider widget_featured_meta', 'description' => __( 'Display latest posts or posts of specific category, which will be used as the slider.', 'colormag' ) ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::__construct( false, $name = __( 'TG: Featured Category Slider', 'colormag' ), $widget_ops ); } function form( $instance ) { $tg_defaults[ 'number' ] = 4; $tg_defaults[ 'type' ] = 'latest'; $tg_defaults[ 'category' ] = ''; $instance = wp_parse_args( ( array ) $instance, $tg_defaults ); $number = $instance[ 'number' ]; $type = $instance[ 'type' ]; $category = $instance[ 'category' ]; ?>

id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="latest"/>
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="category"/>

' ', 'name' => $this->get_field_name( 'category' ), 'selected' => $category ) ); ?>

$number, 'post_type' => 'post', 'ignore_sticky_posts' => true, 'post_status' => $post_status, ) ); } else { $get_featured_posts = new WP_Query( array( 'posts_per_page' => $number, 'post_type' => 'post', 'category__in' => $category, ) ); } echo $before_widget; ?>
have_posts() ):$get_featured_posts->the_post(); if ( $i == 1 ) { $classes = "single-slide displayblock"; } else { $classes = "single-slide displaynone"; } ?>
ID ); $image_alt_text = get_post_meta( $thumbnail_id, '_wp_attachment_image_alt', true ); $title_attribute = get_the_title( $post->ID ); if ( empty( $image_alt_text ) ) { $image_alt_text = $title_attribute; } $image .= ''; echo $image; } else { ?>

'widget_highlighted_posts widget_featured_meta', 'description' => __( 'Display latest posts or posts of specific category. Suitable for the Area Beside Slider Sidebar.', 'colormag' ) ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::__construct( false, $name = __( 'TG: Highlighted Posts', 'colormag' ), $widget_ops ); } function form( $instance ) { $tg_defaults[ 'number' ] = 4; $tg_defaults[ 'type' ] = 'latest'; $tg_defaults[ 'category' ] = ''; $instance = wp_parse_args( ( array ) $instance, $tg_defaults ); $number = $instance[ 'number' ]; $type = $instance[ 'type' ]; $category = $instance[ 'category' ]; ?>

id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="latest"/>
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="category"/>

' ', 'name' => $this->get_field_name( 'category' ), 'selected' => $category ) ); ?>

$number, 'post_type' => 'post', 'ignore_sticky_posts' => true, 'post_status' => $post_status, ) ); } else { $get_featured_posts = new WP_Query( array( 'posts_per_page' => $number, 'post_type' => 'post', 'category__in' => $category, ) ); } echo $before_widget; ?>
have_posts() ):$get_featured_posts->the_post(); ?>
ID ); $image_alt_text = get_post_meta( $thumbnail_id, '_wp_attachment_image_alt', true ); $title_attribute = get_the_title( $post->ID ); if ( empty( $image_alt_text ) ) { $image_alt_text = $title_attribute; } $image .= ''; echo $image; } else { ?>

'widget_featured_posts widget_featured_meta', 'description' => __( 'Display latest posts or posts of specific category.', 'colormag' ) ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::__construct( false, $name = __( 'TG: Featured Posts (Style 1)', 'colormag' ), $widget_ops ); } function form( $instance ) { $tg_defaults[ 'title' ] = ''; $tg_defaults[ 'text' ] = ''; $tg_defaults[ 'number' ] = 4; $tg_defaults[ 'type' ] = 'latest'; $tg_defaults[ 'category' ] = ''; $instance = wp_parse_args( ( array ) $instance, $tg_defaults ); $title = esc_attr( $instance[ 'title' ] ); $text = esc_textarea( $instance[ 'text' ] ); $number = $instance[ 'number' ]; $type = $instance[ 'type' ]; $category = $instance[ 'category' ]; ?>

id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="latest"/>
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="category"/>

' ', 'name' => $this->get_field_name( 'category' ), 'selected' => $category ) ); ?>

$number, 'post_type' => 'post', 'ignore_sticky_posts' => true, 'post_status' => $post_status, ) ); } else { $get_featured_posts = new WP_Query( array( 'posts_per_page' => $number, 'post_type' => 'post', 'category__in' => $category, ) ); } echo $before_widget; ?> ' . esc_html( $title ) . ''; } if ( ! empty( $text ) ) { ?>

have_posts() ):$get_featured_posts->the_post(); ?> '; } else if ( $i == 2 ) { echo '
'; } ?>
ID ); $image_alt_text = get_post_meta( $thumbnail_id, '_wp_attachment_image_alt', true ); $title_attribute = get_the_title( $post->ID ); if ( empty( $image_alt_text ) ) { $image_alt_text = $title_attribute; } $image .= '
'; $image .= ''; $image .= get_the_post_thumbnail( $post->ID, $featured, array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $image_alt_text ) ) ) . ''; $image .= '
'; echo $image; } ?>

'; } ?> 2 ) { echo '
'; } // Reset Post Data wp_reset_query(); ?> 'widget_featured_posts widget_featured_posts_vertical widget_featured_meta', 'description' => __( 'Display latest posts or posts of specific category.', 'colormag' ) ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::__construct( false, $name = __( 'TG: Featured Posts (Style 2)', 'colormag' ), $widget_ops ); } function form( $instance ) { $tg_defaults[ 'title' ] = ''; $tg_defaults[ 'text' ] = ''; $tg_defaults[ 'number' ] = 4; $tg_defaults[ 'type' ] = 'latest'; $tg_defaults[ 'category' ] = ''; $instance = wp_parse_args( ( array ) $instance, $tg_defaults ); $title = esc_attr( $instance[ 'title' ] ); $text = esc_textarea( $instance[ 'text' ] ); $number = $instance[ 'number' ]; $type = $instance[ 'type' ]; $category = $instance[ 'category' ]; ?>

id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="latest"/>
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="category"/>

' ', 'name' => $this->get_field_name( 'category' ), 'selected' => $category ) ); ?>

$number, 'post_type' => 'post', 'ignore_sticky_posts' => true, 'post_status' => $post_status, ) ); } else { $get_featured_posts = new WP_Query( array( 'posts_per_page' => $number, 'post_type' => 'post', 'category__in' => $category, ) ); } echo $before_widget; ?> ' . esc_html( $title ) . ''; } if ( ! empty( $text ) ) { ?>

have_posts() ):$get_featured_posts->the_post(); ?> '; } else if ( $i == 2 ) { echo '
'; } ?>
ID ); $image_alt_text = get_post_meta( $thumbnail_id, '_wp_attachment_image_alt', true ); $title_attribute = get_the_title( $post->ID ); if ( empty( $image_alt_text ) ) { $image_alt_text = $title_attribute; } $image .= '
'; $image .= ''; $image .= get_the_post_thumbnail( $post->ID, $featured, array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $image_alt_text ) ) ) . ''; $image .= '
'; echo $image; } ?>

'; } ?> 2 ) { echo '
'; } // Reset Post Data wp_reset_query(); ?> 'widget_300x250_advertisement', 'description' => __( 'Add your 300x250 Advertisement here', 'colormag' ) ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::__construct( false, $name = __( 'TG: 300x250 Advertisement', 'colormag' ), $widget_ops ); } function form( $instance ) { $instance = wp_parse_args( ( array ) $instance, array( 'title' => '', '300x250_image_url' => '', '300x250_image_link' => '' ) ); $title = esc_attr( $instance[ 'title' ] ); $image_link = '300x250_image_link'; $image_url = '300x250_image_url'; $instance[ $image_link ] = esc_url( $instance[ $image_link ] ); $instance[ $image_url ] = esc_url( $instance[ $image_url ] ); ?>

'; echo $output; } ?> 'widget_728x90_advertisement', 'description' => __( 'Add your 728x90 Advertisement here', 'colormag' ) ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::__construct( false, $name = __( 'TG: 728x90 Advertisement', 'colormag' ), $widget_ops ); } function form( $instance ) { $instance = wp_parse_args( ( array ) $instance, array( 'title' => '', '728x90_image_url' => '', '728x90_image_link' => '' ) ); $title = esc_attr( $instance[ 'title' ] ); $image_link = '728x90_image_link'; $image_url = '728x90_image_url'; $instance[ $image_link ] = esc_url( $instance[ $image_link ] ); $instance[ $image_url ] = esc_url( $instance[ $image_url ] ); ?>

'; echo $output; } ?> 'widget_125x125_advertisement', 'description' => __( 'Add your 125x125 Advertisement here', 'colormag' ) ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::__construct( false, $name = __( 'TG: 125x125 Advertisement', 'colormag' ), $widget_ops ); } function form( $instance ) { $instance = wp_parse_args( ( array ) $instance, array( 'title' => '', '125x125_image_url_1' => '', '125x125_image_url_2' => '', '125x125_image_url_3' => '', '125x125_image_url_4' => '', '125x125_image_url_5' => '', '125x125_image_url_6' => '', '125x125_image_link_1' => '', '125x125_image_link_2' => '', '125x125_image_link_3' => '', '125x125_image_link_4' => '', '125x125_image_link_5' => '', '125x125_image_link_6' => '' ) ); $title = esc_attr( $instance[ 'title' ] ); for ( $i = 1; $i < 7; $i ++ ) { $image_link = '125x125_image_link_' . $i; $image_url = '125x125_image_url_' . $i; $instance[ $image_link ] = esc_url( $instance[ $image_link ] ); $instance[ $image_url ] = esc_url( $instance[ $image_url ] ); } ?>

'; echo $output; } ?>