__( 'Right Sidebar', 'ample' ),
'id' => 'ample_right_sidebar',
'description' => __('Shows widgets at right side.', 'ample' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Left Sidebar', 'ample' ),
'id' => 'ample_left_sidebar',
'description' => __('Shows widgets at left side.', 'ample' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Business Sidebar', 'ample' ),
'id' => 'ample_business_sidebar',
'description' => __('Shows widgets on Business Page Template.', 'ample' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Error 404 Page Sidebar', 'ample' ),
'id' => 'ample_error_404_page_sidebar',
'description' => __('Shows widgets on Error 404 page.', 'ample' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Contact Page Sidebar', 'ample' ),
'id' => 'ample_contact_page_sidebar',
'description' => __('Shows widgets on Right/Left side of Contact page.', 'ample' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Sidebar1', 'ample' ),
'id' => 'ample_footer_sidebar1',
'description' => __('Shows widgets on footer.', 'ample' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Sidebar2', 'ample' ),
'id' => 'ample_footer_sidebar2',
'description' => __('Shows widgets on footer.', 'ample' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Sidebar3', 'ample' ),
'id' => 'ample_footer_sidebar3',
'description' => __('Shows widgets on footer.', 'ample' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Sidebar4', 'ample' ),
'id' => 'ample_footer_sidebar4',
'description' => __('Shows widgets on footer.', 'ample' ),
'before_widget' => '',
'before_title' => '',
) );
register_widget("ample_service_widget");
register_widget("ample_portfolio_widget");
register_widget("ample_call_to_action_widget");
register_widget("ample_featured_posts_widget");
}
/**************************************************************************************/
/**
* Featured recent work widget to show pages.
*/
class ample_service_widget extends WP_Widget {
function __construct() {
$widget_ops = array( 'classname' => 'widget_service_block', 'description' => __( 'Show your some pages as services.', 'ample' ) );
$control_ops = array( 'width' => 200, 'height' =>250 );
parent::__construct( false, $name = __( 'TG: Service Widget', 'ample' ), $widget_ops, $control_ops);
}
function form( $instance ) {
for ( $i=1; $i<=6; $i++ ) {
$var = 'page_id'.$i;
$defaults[$var] = '';
}
$defaults['title'] = '';
$defaults['text'] = '';
$defaults['image'] = '';
$instance = wp_parse_args( (array) $instance, $defaults );
$title = esc_attr( $instance[ 'title' ] );
$text = esc_textarea( $instance['text'] );
$image = esc_url_raw( $instance['image'] );
?>
get_field_id( 'image' . 'preview') . '"src="' . $image . '"style="max-width: 250px;" />
';
endif;
?>
Refer here For Icon Class', 'ample' ), esc_url( $url ) );
echo $link;
?>
' ','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;
if ( !empty( $title ) ) { ?>
have_posts() ):$get_featured_pages->the_post();
if ( $count == 2 ) { $service_wrap_class = 'single-service tg-one-third tg-one-third-last'; }
else { $service_wrap_class = 'single-service tg-one-third'; }
?>
'widget_portfolio_block', 'description' => __( 'Display portfolio by using specific category', 'ample') );
$control_ops = array( 'width' => 200, 'height' =>250 );
parent::__construct( false,$name= __( 'TG: Portfolio', 'ample' ), $widget_ops);
}
function form( $instance ) {
$tg_defaults['background_color'] = '#80abc8';
$tg_defaults['background_image' ] = '';
$tg_defaults['attachment' ] = 'scroll';
$tg_defaults['title'] = '';
$tg_defaults['text'] = '';
$tg_defaults['number'] = 4;
$tg_defaults['category'] = '';
$tg_defaults['button_text'] = '';
$tg_defaults['button_url' ] = '';
$instance = wp_parse_args( (array) $instance, $tg_defaults );
$background_color = esc_attr( $instance[ 'background_color' ] );
$background_image = esc_url_raw( $instance[ 'background_image' ] );
$attachment = $instance[ 'attachment' ];
$title = esc_attr( $instance[ 'title' ] );
$text = esc_textarea( $instance[ 'text' ] );
$number = $instance['number'];
$category = $instance['category'];
$button_text = esc_attr( $instance[ 'button_text' ] );
$button_url = esc_url( $instance[ 'button_url' ] );
?>
get_field_id( 'background_image' . 'preview') . '"src="' . $background_image . '"style="max-width:250px;" />
';
endif;
?>
id="get_field_id( 'attachment' ); ?>" name="get_field_name( 'attachment' ); ?>" value="scroll" />
id="get_field_id( 'attachment' ); ?>" name="get_field_name( 'attachment' ); ?>" value="fixed" style="margin-left:20px;"/>
' ','name' => $this->get_field_name( 'category' ), 'selected' => $category ) ); ?>
$number,
'post_type' => 'post',
'category__in' => $category
) );
echo $before_widget;
$image_style = '';
if ( !empty( $background_image ) ) {
$image_style .= 'background-image:url(' . $background_image . ');background-attachment:' . $attachment . ';background-repeat:no-repeat;background-size:cover;';
}else {
$image_style .= 'background-color:' . $background_color . ';';
}?>
0 ) : ?>
have_posts() ):$get_featured_posts->the_post();
if ( $i % 4 == 0 ) { $class = 'tg-one-fourth tg-one-fourth-last'; }
elseif( $i % 3 == 0 ) { $class= 'tg-one-fourth tg-after-two-blocks-clearfix'; }
else { $class = 'tg-one-fourth'; }
if ( $i % 2 == 1 ) { $class .= ' '.'tg-column-odd'; }
else { $class .= ' '.'tg-column-even'; }
?>
'widget_featured_posts_block', 'description' => __( 'Display latest posts or posts of specific category', 'ample') );
$control_ops = array( 'width' => 200, 'height' =>250 );
parent::__construct( false,$name= __( 'TG: Featured Posts', 'ample' ),$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
) );
}
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();
?>
1) { $class .= ' tg-featured-posts-clearfix'; }
?>
'widget_call_to_action_block', 'description' => __( 'Use this widget to show the call to action section.', 'ample' ) );
$control_ops = array( 'width' => 200, 'height' =>250 );
parent::__construct( false, $name = __( 'TG: Call To Action Widget', 'ample' ), $widget_ops, $control_ops);
}
function form( $instance ) {
$ample_defaults[ 'background_color' ] = '#80abc8';
$ample_defaults[ 'background_image' ] = '';
$ample_defaults[ 'bg_attachment' ] = 'scroll';
$ample_defaults[ 'text_main' ] = '';
$ample_defaults[ 'button_text' ] = '';
$ample_defaults[ 'button_url' ] = '';
$instance = wp_parse_args( (array) $instance, $ample_defaults );
$background_color = esc_attr( $instance[ 'background_color' ] );
$text_additional = esc_url_raw( $instance[ 'background_image' ] );
$bg_attachment = $instance[ 'bg_attachment' ];
$text_main = esc_textarea( $instance[ 'text_main' ] );
$button_text = esc_attr( $instance[ 'button_text' ] );
$button_url = esc_url( $instance[ 'button_url' ] );
?>
get_field_id( 'background_image' . 'preview') . '"src="' . $instance[ 'background_image' ] . '"style="max-width:250px;" />
';
endif;
?>
id="get_field_id( 'bg_attachment' ); ?>" name="get_field_name( 'bg_attachment' ); ?>" value="scroll" />
id="get_field_id( 'bg_attachment' ); ?>" name="get_field_name( 'bg_attachment' ); ?>" value="fixed" style="margin-left:20px;"/>