esc_html__( 'Right Sidebar', 'colornews' ), 'id' => 'colornews_right_sidebar', 'description' => __( 'Shows widgets at the Right Sidebar.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering left sidebar register_sidebar( array( 'name' => esc_html__( 'Left Sidebar', 'colornews' ), 'id' => 'colornews_left_sidebar', 'description' => __( 'Shows widgets at the Left Sidebar.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering header sidebar register_sidebar( array( 'name' => esc_html__( 'Header Sidebar', 'colornews' ), 'id' => 'colornews_header_sidebar', 'description' => __( 'Shows widgets in the Header Section just above the main navigation menu.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering contact page sidebar register_sidebar( array( 'name' => esc_html__( 'Contact Page Sidebar', 'colornews' ), 'id' => 'colornews_contact_page_sidebar', 'description' => __( 'Shows widgets in the Contact Page sidebar.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering 404 page sidebar register_sidebar( array( 'name' => esc_html__( '404 Error Page Sidebar', 'colornews' ), 'id' => 'colornews_error_404_page_sidebar', 'description' => __( 'Shows widgets in the 404 Error Page sidebar.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering front page slider area register_sidebar( array( 'name' => esc_html__( 'Front Page: Slider Area', 'colornews' ), 'id' => 'colornews_front_slider_area', 'description' => __( 'Shows widgets in the Front Page: Slider Area. Suitable for TG: Featured Posts (Style 1) widget.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering front page content top section register_sidebar( array( 'name' => esc_html__( 'Front Page: Content Top Section', 'colornews' ), 'id' => 'colornews_front_content_top_section', 'description' => __( 'Shows widgets in the Front Page: Content Top Section.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering front page content left section register_sidebar( array( 'name' => esc_html__( 'Front Page: Content Middle Left Section', 'colornews' ), 'id' => 'colornews_front_content_left_section', 'description' => __( 'Shows widgets in the Front Page: Content Middle Left Section.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering front page content right section register_sidebar( array( 'name' => esc_html__( 'Front Page: Content Middle Right Section', 'colornews' ), 'id' => 'colornews_front_content_right_section', 'description' => __( 'Shows widgets in the Front Page: Content Middle Right Section.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering front page content top section register_sidebar( array( 'name' => esc_html__( 'Front Page: Content Bottom Section', 'colornews' ), 'id' => 'colornews_front_content_bottom_section', 'description' => __( 'Shows widgets in the Front Page: Content Bottom Section.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering footer advertisement area register_sidebar( array( 'name' => esc_html__( 'Advertisement Above Footer', 'colornews' ), 'id' => 'colornews_advertisement_above_footer', 'description' => __( 'Shows widgets just above the Footer Area.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering footer advertisement area register_sidebar( array( 'name' => esc_html__( 'Footer Sidebar One', 'colornews' ), 'id' => 'colornews_footer_sidebar_one', 'description' => __( 'Shows widgets in the Footer Sidebar One.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering footer advertisement area register_sidebar( array( 'name' => esc_html__( 'Footer Sidebar Two', 'colornews' ), 'id' => 'colornews_footer_sidebar_two', 'description' => __( 'Shows widgets in the Footer Sidebar Two.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // registering footer advertisement area register_sidebar( array( 'name' => esc_html__( 'Footer Sidebar Three', 'colornews' ), 'id' => 'colornews_footer_sidebar_three', 'description' => __( 'Shows widgets in the Footer Sidebar Three.', 'colornews' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // our custom made widgets register_widget( "colornews_728x90_advertisement_widget" ); register_widget( "colornews_300x250_advertisement_widget" ); register_widget( "colornews_125x125_advertisement_widget" ); // featured posts widgets register_widget( "colornews_featured_post_style_one_widget" ); register_widget( "colornews_featured_post_style_two_widget" ); register_widget( "colornews_featured_post_style_three_widget" ); register_widget( "colornews_featured_post_style_four_widget" ); register_widget( "colornews_random_posts_widget" ); register_widget( "colornews_popular_posts_widget" ); register_widget( "colornews_custom_tag_widget" ); } add_action( 'widgets_init', 'colornews_widgets_init' ); /****************************************************************************************/ /** * 728x90 Advertisement Ads Widget */ class colornews_728x90_advertisement_widget extends WP_Widget { function __construct() { $widget_ops = array( 'classname' => 'widget_728x90_advertisement colornews_custom_widget', 'description' => __( 'Add your 728x90 Advertisement here', 'colornews') ); $control_ops = array( 'width' => 200, 'height' =>250 ); parent::__construct( false,$name= __( 'TG: 728x90 Advertisement', 'colornews' ),$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 ] ); ?>

get_field_id( $instance[ $image_url ] . 'preview') . '"src="' . $instance[ $image_url ] . '"style="max-width:250px;" />
'; endif; ?>

'; if ( !empty( $image_link ) ) { $output .= ''; } else { $output .= ''; } $output .= '
'; echo $output; } ?>
'widget_300x250_advertisement colornews_custom_widget', 'description' => __( 'Add your 300x250 Advertisement here', 'colornews') ); $control_ops = array( 'width' => 200, 'height' =>250 ); parent::__construct( false,$name= __( 'TG: 300x250 Advertisement', 'colornews' ),$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 ] ); ?>

get_field_id( $instance[ $image_url ] . 'preview') . '"src="' . $instance[ $image_url ] . '"style="max-width:250px;" />
'; endif; ?>

'; if ( !empty( $image_link ) ) { $output .= ''; } else { $output .= ''; } $output .= '
'; echo $output; } ?>
'widget_125x125_advertisement colornews_custom_widget', 'description' => __( 'Add your 125x125 Advertisement here', 'colornews') ); $control_ops = array( 'width' => 200, 'height' =>250 ); parent::__construct( false,$name= __( 'TG: 125x125 Advertisement', 'colornews' ),$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 ] ); } ?>

get_field_id( $instance[$image_url] . 'preview') . '"src="' . $instance[$image_url] . '"style="max-width:250px;" />
'; endif; ?>

'; for ( $i = 1; $i < 7; $i++ ) { $j = $i - 1; if( !empty( $image_array[$j] ) ) { if ( !empty( $link_array[$j] ) ) { $output .= ''; } else { $output .= ''; } } } $output .= '
'; echo $output; } ?>
'widget_featured_posts_style_one colornews_custom_widget', 'description' => __( 'Display latest posts or posts of specific category. Suitable for the Front Page: Slider Area.', 'colornews') ); $control_ops = array( 'width' => 200, 'height' =>250 ); parent::__construct( false,$name= __( 'TG: Featured Post (Style 1)', 'colornews' ),$widget_ops); } function form( $instance ) { $tg_defaults['number'] = 5; $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 ) ); } else { $get_featured_posts = new WP_Query( array( 'posts_per_page' => $number, 'post_type' => 'post', 'category__in' => $category ) ); } echo $before_widget; ?>
post_count; while( $get_featured_posts->have_posts() ):$get_featured_posts->the_post(); $j = $i-1; $title_attribute = get_the_title( $post->ID ); if (has_post_thumbnail()) { $big_image = '' . get_the_post_thumbnail( $post->ID, 'colornews-big-slider', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ) . ''; $thumbnail_image .= '' . get_the_post_thumbnail( $post->ID, 'colornews-big-slider-thumb', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ) . ''; } else { $big_image = '' . ''; $thumbnail_image .= '' . ''; } $big_image_output .= '
  • '.$big_image.'
    '.colornews_colored_category_return(0).'
  • '; if ( $i == $number || $i == $post_count ) { ?>
    'widget_featured_posts_style_two colornews_custom_widget', 'description' =>__( 'Display latest posts or posts of specific category.' , 'colornews') ); $control_ops = array( 'width' => 200, 'height' =>250 ); parent::__construct( false,$name= __( 'TG: Featured Posts (Style 2)', 'colornews' ),$widget_ops); } function form( $instance ) { $tg_defaults['title'] = ''; $tg_defaults['number'] = 4; $tg_defaults['type'] = 'latest'; $tg_defaults['category'] = ''; $instance = wp_parse_args( (array) $instance, $tg_defaults ); $title = esc_attr( $instance[ 'title' ] ); $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 ) ); } else { $get_featured_posts = new WP_Query( array( 'posts_per_page' => $number, 'post_type' => 'post', 'category__in' => $category ) ); } echo $before_widget; ?>
    '. esc_html( $title ) .''; } ?>
    have_posts() ):$get_featured_posts->the_post(); ?>
    '; } elseif ( $i == 2 ) { echo '
    '; } ?>
    ID ); $image .= '
    '; $image .= ''; $image .= get_the_post_thumbnail( $post->ID, $featured, array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).''; if ( $i == 1 ) { $image .= colornews_colored_category_return(0); } $image .= '
    '; echo $image; } ?>

    ', 'colornews'); ?>
    '; } ?> 2 ) { echo '
    '; } // Reset Post Data wp_reset_query(); ?>
    'widget_featured_posts_style_three colornews_custom_widget', 'description' => __( 'Display latest posts or posts of specific category.', 'colornews') ); $control_ops = array( 'width' => 200, 'height' =>250 ); parent::__construct( false,$name= __( 'TG: Featured Posts (Style 3)', 'colornews' ),$widget_ops); } function form( $instance ) { $tg_defaults['title'] = ''; $tg_defaults['number'] = 4; $tg_defaults['type'] = 'latest'; $tg_defaults['category'] = ''; $instance = wp_parse_args( (array) $instance, $tg_defaults ); $title = esc_attr( $instance[ 'title' ] ); $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 ) ); } else { $get_featured_posts = new WP_Query( array( 'posts_per_page' => $number, 'post_type' => 'post', 'category__in' => $category ) ); } echo $before_widget; ?>
    '. esc_html( $title ) .''; } ?>
    have_posts() ):$get_featured_posts->the_post(); ?> '; } elseif ( $i == 2 ) { echo '
    '; } ?>
    ID ); $image .= '
    '; $image .= ''; $image .= get_the_post_thumbnail( $post->ID, $featured, array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).''; if ( $i == 1 ) { $image .= colornews_colored_category_return(0); } $image .= '
    '; echo $image; } ?>

    ', 'colornews'); ?>
    '; } ?> 2 ) { echo '
    '; } // Reset Post Data wp_reset_query(); ?>
    'widget_featured_posts_style_four colornews_custom_widget', 'description' => __( 'Display latest posts or posts of specific category.', 'colornews') ); $control_ops = array( 'width' => 200, 'height' =>250 ); parent::__construct( false,$name= __( 'TG: Featured Posts (Style 4)', 'colornews' ),$widget_ops); } function form( $instance ) { $tg_defaults['title'] = ''; $tg_defaults['number'] = 5; $tg_defaults['type'] = 'latest'; $tg_defaults['category'] = ''; $instance = wp_parse_args( (array) $instance, $tg_defaults ); $title = esc_attr( $instance[ 'title' ] ); $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 ) ); } else { $get_featured_posts = new WP_Query( array( 'posts_per_page' => $number, 'post_type' => 'post', 'category__in' => $category ) ); } echo $before_widget; ?>
    '. esc_html( $title ) .''; } ?>
    'colornews_random_post colornews_custom_widget', 'description' => __( 'Displays the random posts from your site. Suitable for the Right/Left sidebar.', 'colornews') ); $control_ops = array( 'width' => 200, 'height' =>250 ); parent::__construct( false,$name= __( 'TG: Random Posts Widget', 'colornews' ),$widget_ops); } function form( $instance ) { $tg_defaults['number'] = 6; $tg_defaults['title'] = ''; $instance = wp_parse_args( (array) $instance, $tg_defaults ); $number = $instance['number']; $title = esc_attr( $instance[ 'title' ] ); ?>

    $number, 'post_type' => 'post', 'ignore_sticky_posts' => true, 'orderby' => 'rand' ) ); ?>
    have_posts() ):$get_featured_posts->the_post(); if ( ( $j == $number ) || ( $j == $number - 1 ) || ( $j == $number - 2 ) ) { $class = ""; } else { $class = "tg-column-bottom-margin"; } ?>
    ID ); $image .= get_the_post_thumbnail( $post->ID, $featured, array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ); $image .= colornews_colored_category_return(0); echo $image; } else { ?>

    'colornews_popular_post colornews_custom_widget', 'description' => __( 'Displays the popular posts. Suitable for the Right/Left sidebar.', 'colornews') ); $control_ops = array( 'width' => 200, 'height' =>250 ); parent::__construct( false,$name= __( 'TG: Popular Posts Widget', 'colornews' ),$widget_ops); } function form( $instance ) { $tg_defaults['number'] = 4; $tg_defaults['title'] = ''; $instance = wp_parse_args( (array) $instance, $tg_defaults ); $number = $instance['number']; $title = esc_attr( $instance[ 'title' ] ); ?>

    $number, 'post_type' => 'post', 'ignore_sticky_posts' => true, 'orderby' => 'comment_count' ) ); ?>
    have_posts() ):$get_featured_posts->the_post(); ?>
    ID ); $image .= '
    '; $image .= ''; $image .= get_the_post_thumbnail( $post->ID, $featured, array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).''; $image .= '
    '; echo $image; } ?>

    'colornews_tagcloud_widget colornews_custom_widget', 'description' => __( 'This widget will display the Custom Tags.', 'colornews' ) ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::__construct( false, $name = __( 'TG: Custom Tag Cloud', 'colornews' ) , $widget_ops, $control_ops ); } function form($instance) { $instance = wp_parse_args( ( array ) $instance, array( 'title'=>'Tags' ) ); $title = esc_attr( $instance[ 'title' ] ); ?>

    16, 'largest' => 30, 'unit' => 'px', 'number' => 75, ); ?>