__('Left Sidebar', 'ambition') , 'id' => 'ambition_left_sidebar', 'description' => __('Shows widgets at Left side.', 'ambition') , 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); // Registering main right sidebar register_sidebar(array( 'name' => __('Right Sidebar', 'ambition') , 'id' => 'ambition_right_sidebar', 'description' => __('Shows widgets at Right side.', 'ambition') , 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); // Registering Business Page template sidebar register_sidebar(array( 'name' => __('Business Page Section', 'ambition') , 'id' => 'ambition_business_page_sidebar', 'description' => __('Shows widgets on Business Page Template. Suitable widget: TH: Featured Page, TH: Featured Recent Work, TH: Testimonial, TH: Services, TH: PromoBox', 'ambition') , 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

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

', 'after_title' => '

', )); /** * Registering footer sidebar 1 * For upgrade compatible reason footer id not kept ambition_footer_column1 */ register_sidebar(array( 'name' => __('Footer - Column1', 'ambition') , 'id' => 'ambition_footer_sidebar', 'description' => __('Shows widgets at footer Column 1.', 'ambition') , 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); // Registering footer sidebar 2 register_sidebar(array( 'name' => __('Footer - Column2', 'ambition') , 'id' => 'ambition_footer_column2', 'description' => __('Shows widgets at footer Column 2.', 'ambition') , 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); // Registering footer sidebar 3 register_sidebar(array( 'name' => __('Footer - Column3', 'ambition') , 'id' => 'ambition_footer_column3', 'description' => __('Shows widgets at footer Column 3.', 'ambition') , 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); // Registering footer sidebar 4 register_sidebar(array( 'name' => __('Footer - Column4', 'ambition') , 'id' => 'ambition_footer_column4', 'description' => __('Shows widgets at footer Column 4.', 'ambition') , 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); // Registering widgets register_widget("ambition_custom_tag_widget"); register_widget("ambition_service_widget"); register_widget("ambition_promobox_widget"); register_widget("ambition_recent_work_widget"); register_widget("ambition_Widget_Testimonial"); register_widget("ambition_Widget_featured_page"); register_widget("ambition_featured_image_widget"); } /****************************************************************************************/ /** * Widget for business layout that shows selected page content,title and featured image. * Construct the widget. * i.e. Name, description and control options. */ class ambition_Widget_featured_page extends WP_Widget { function ambition_Widget_featured_page() { $widget_ops = array( 'classname' => 'widget_featured_page', 'description' => __('Display Featured Page ( Business Layout )', 'ambition') ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::WP_Widget(false, $name = __('TH: Featured Page', 'ambition') , $widget_ops, $control_ops); } function form($instance) { $instance = wp_parse_args((array)$instance, array( 'description' => '', 'left' => true, 'right' => false, 'middle' => false )); for ($i = 0; $i < 1; $i++) { $var = 'page_id' . $i; $defaults[$var] = ''; } $instance = wp_parse_args((array)$instance, $defaults); for ($i = 0; $i < 1; $i++) { $var = 'page_id' . $i; $var = absint($instance[$var]); } $description = esc_textarea($instance['description']); $featured_display = ( isset( $instance['featured_display'] ) && is_numeric( $instance['featured_display'] ) ) ? (int) $instance['featured_display'] : 1; ?>

> > >

' ', 'name' => $this->get_field_name(key($defaults)) , 'selected' => $instance[key($defaults) ] )); ?> 0 && $new_instance['featured_display'] < 4 ) ? (int) $new_instance['featured_display'] : 0; for ($i = 0; $i < 1; $i++) { $var = 'page_id' . $i; $instance[$var] = absint($new_instance[$var]); } return $instance; } function widget($args, $instance) { $featured_display = ( isset( $instance['featured_display'] ) && is_numeric( $instance['featured_display'] ) ) ? (int) $instance['featured_display'] : 1; extract($args); extract($instance); global $post; $page_array = array(); for ($i = 0; $i < 1; $i++) { $var = 'page_id' . $i; $page_id = isset($instance[$var]) ? $instance[$var] : ''; if (!empty($page_id)) { array_push($page_array, $page_id); } // Push the page id in the array } $get_featured_pages = new WP_Query(array( 'posts_per_page' => - 1, 'post_type' => array( 'page' ) , 'post__in' => $page_array, 'orderby' => 'post__in' )); echo $before_widget; $j = 1; while ($get_featured_pages->have_posts()): $get_featured_pages->the_post(); $page_title = get_the_title();?>
'; } } /****************************************************************************************/ /** * Extends class wp_widget * * Creates a function CustomTagWidget * $widget_ops option array passed to wp_register_sidebar_widget(). * $control_ops option array passed to wp_register_widget_control(). * $name, Name for this widget which appear on widget bar. */ class ambition_custom_tag_widget extends WP_Widget { function ambition_custom_tag_widget() { $widget_ops = array( 'classname' => 'widget_custom-tagcloud', 'description' => __('Displays Custom Tag Cloud', 'ambition') ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::WP_Widget(false, $name = __('TH: Custom Tag Cloud', 'ambition') , $widget_ops, $control_ops); } /** Displays the Widget in the front-end. * * $args Display arguments including before_title, after_title, before_widget, and after_widget. * $instance The settings for the particular instance of the widget */ function widget($args, $instance) { extract($args); extract($instance); $title = empty($instance['title']) ? 'Tags' : $instance['title']; echo $before_widget; if ($title): echo $before_title . $title . $after_title; endif; wp_tag_cloud('smallest=13&largest=13px&unit=px'); echo $after_widget . ''; } /** * update the particular instant * * This function should check that $new_instance is set correctly. * The newly calculated value of $instance should be returned. * If "false" is returned, the instance won't be saved/updated. * * $new_instance New settings for this instance as input by the user via form() * $old_instance Old settings for this instance * Settings to save or bool false to cancel saving */ function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); return $instance; } /** * Creates the form for the widget in the back-end which includes the Title * $instance Current settings */ function form($instance) { $instance = wp_parse_args(( array )$instance, array( 'title' => 'Tags' )); $title = esc_attr($instance['title']); ?>

'widget_service', 'description' => __('Display Services ( Business Layout )', 'ambition') ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::WP_Widget(false, $name = __('TH: Services', 'ambition') , $widget_ops, $control_ops); } function form($instance) { for ($i = 0; $i < 6; $i++) { $var = 'page_id' . $i; $defaults[$var] = ''; } $instance = wp_parse_args((array)$instance, $defaults); for ($i = 0; $i < 6; $i++) { $var = 'page_id' . $i; $var = absint($instance[$var]); } for ($i = 0; $i < 6; $i++) { ?>

' ', 'name' => $this->get_field_name(key($defaults)) , 'selected' => $instance[key($defaults) ] )); ?>

- 1, 'post_type' => array( 'page' ) , 'post__in' => $page_array, 'orderby' => 'post__in' )); echo $before_widget; ?>
have_posts()):$get_featured_pages->the_post(); $page_title = get_the_title(); if ($j%6 == 1 && $j > 1) { $service_class = "one-third clearfix-half clearfix-third"; } elseif ($j%2 == 1 && $j > 1) { $service_class = "one-third clearfix-half"; } elseif ($j%3 == 1 && $j > 1) { $service_class = "one-third clearfix-third"; } else { $service_class = "one-third"; } ?>

130){ $excerpt_length = substr($excerpt, 0 , 130); echo $excerpt_length . '...'; ?>

'widget_promotional_bar', 'description' => __('Display PromoBox ( Business Layout )', 'ambition') ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::WP_Widget(false, $name = __('TH: PromoBox', 'ambition') , $widget_ops, $control_ops); } function widget($args, $instance) { extract($args); $ambition_promotional_img_background = apply_filters('ambition_promotional_img_background', empty($instance['ambition_promotional_img_background']) ? '' : $instance['ambition_promotional_img_background'], $instance, $this->id_base); $ambition_widget_primary = apply_filters('ambition_widget_primary', empty($instance['ambition_widget_primary']) ? '' : $instance['ambition_widget_primary'], $instance, $this->id_base); $ambition_widget_secondary = apply_filters('ambition_widget_secondary', empty($instance['ambition_widget_secondary']) ? '' : $instance['ambition_widget_secondary'], $instance, $this->id_base); $ambition_redirect_text = apply_filters('ambition_redirect_text', empty($instance['ambition_redirect_text']) ? '' : $instance['ambition_redirect_text'], $instance); $ambition_widget_redirecturl = apply_filters('ambition_widget_redirecturl', empty($instance['ambition_widget_redirecturl']) ? '' : $instance['ambition_widget_redirecturl'], $instance, $this->id_base); echo $before_widget; ?>
style="background-image:url('');" >

'; } function update($new_instance, $old_instance) { $instance = $old_instance; $instance['ambition_promotional_img_background'] = strip_tags($new_instance['ambition_promotional_img_background']); $instance['ambition_widget_primary'] = esc_textarea($new_instance['ambition_widget_primary']); $instance['ambition_widget_secondary'] = esc_textarea($new_instance['ambition_widget_secondary']); $instance['ambition_widget_redirecturl'] = esc_url($new_instance['ambition_widget_redirecturl']); $instance['ambition_redirect_text'] = strip_tags($new_instance['ambition_redirect_text']); $instance['filter'] = isset($new_instance['filter']); return $instance; } function form($instance) { $instance = wp_parse_args((array)$instance, array( 'ambition_promotional_img_background' => '', 'ambition_widget_primary' => '', 'ambition_widget_secondary' => '', 'ambition_redirect_text' => '', 'ambition_widget_redirecturl' => '' )); $ambition_promotional_img_background = strip_tags($instance['ambition_promotional_img_background']); $ambition_widget_primary = esc_textarea($instance['ambition_widget_primary']); $ambition_widget_secondary = esc_textarea($instance['ambition_widget_secondary']); $ambition_redirect_text = strip_tags($instance['ambition_redirect_text']); $ambition_widget_redirecturl = esc_url($instance['ambition_widget_redirecturl']); ?>

'widget_recent_work clearfix', 'description' => __('Use this widget to show recent work, portfolio or any pages as your wish ( Business Layout )', 'ambition') ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::WP_Widget(false, $name = __('TH: Featured Recent Work', 'ambition') , $widget_ops, $control_ops); } function form($instance) { for ($i = 0; $i < 3; $i++) { $var = 'page_id' . $i; $defaults[$var] = ''; } $att_defaults = $defaults; $att_defaults['title'] = ''; $att_defaults['text'] = ''; $instance = wp_parse_args((array)$instance, $att_defaults); for ($i = 0; $i < 3; $i++) { $var = 'page_id' . $i; $var = absint($instance[$var]); } $title = esc_attr($instance['title']); $text = esc_textarea($instance['text']); ?>

' ', 'name' => $this->get_field_name(key($defaults)) , 'selected' => $instance[key($defaults) ] )); ?>

- 1, 'post_type' => array( 'page' ) , 'post__in' => $page_array, 'orderby' => 'post__in' )); echo $before_widget; ?>

have_posts()): $get_featured_pages->the_post(); $page_title = get_the_title(); ?>
ID, 'ambition-recent-work'); ?> 130){ $excerpt_length = substr($excerpt, 0 , 130); echo $excerpt_length . '...'; } else{ echo $excerpt; }?>
'; } } /**************************************************************************************/ /** * Testimonial widget */ class ambition_Widget_Testimonial extends WP_Widget { function ambition_Widget_Testimonial() { $widget_ops = array( 'classname' => 'widget_testimonial', 'description' => __('Display Testimonial ( Business Layout ) recommendation size ( 168 * 168 )', 'ambition') ); $control_ops = array( 'width' => 200, 'height' => 250 ); parent::WP_Widget(false, $name = __('TH: Testimonial', 'ambition') , $widget_ops, $control_ops); } function form($instance) { $instance = wp_parse_args((array)$instance, array( 'title' => '', 'image1' => '', 'text1' => '', 'name1' => '', 'designation1' => '', 'company_name1' => '', 'company_link1' => '' )); $title = strip_tags($instance['title']); for ($i = 1; $i <= 1; $i++) { $image = 'image' . $i; $text = 'text' . $i; $name = 'name' . $i; $designation = 'designation' . $i; $company_name = 'company_name' . $i; $company_link = 'company_link' . $i; $instance[$image] = esc_url($instance[$image]); $instance[$text] = strip_tags($instance[$text]); $instance[$name] = strip_tags($instance[$name]); $instance[$designation] = strip_tags($instance[$designation]); $instance[$company_name] = strip_tags($instance[$company_name]); $instance[$company_link] = esc_url($instance[$company_link]); } ?>

 


 

<?php if (!empty($name_array[$i])) { echo $name_array[$i]; } ?>
'; } } /*********************************************************************************************************/ class ambition_featured_image_widget extends WP_Widget { function ambition_featured_image_widget() { $widget_ops = array( 'classname' => 'widget_ourclients', 'description' => __( 'Display Featured Clients/ Products ( Business Layout )', 'ambition') ); $control_ops = array('width' => 200, 'height' => 250); parent::WP_Widget( false, $name='TH: Featured Clients/ Products', $widget_ops, $control_ops ); } function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'number' => '5', 'path0' => '', 'path1' => '', 'path2' => '', 'path3' => '', 'path4' => '', 'path5' => '', 'redirectlink0' => '', 'redirectlink1' => '', 'redirectlink2' => '', 'redirectlink3' => '', 'redirectlink4' => '', 'redirectlink5' => '') ); $title = strip_tags($instance['title']); $number = absint( $instance[ 'number' ] ); for ( $i=0; $i<$number; $i++ ) { $var = 'path'.$i; $var1 = 'redirectlink'.$i; $instance[ $var ] = esc_url( $instance[ $var ] ); $instance[ $var1 ] = esc_url( $instance[ $var1 ] ); } ?>


'; $output .= ''; $output .= ''; echo $output; } echo $after_widget .''; } } ?>