/home/desid573/public_html/magicride.ng/wp-content/themes/drizzle-mag/includes
Edit: /home/desid573/public_html/magicride.ng/wp-content/themes/drizzle-mag/includes/widgets.php (28450B)
'drizzle_mag_widget_social',
'description' => esc_html__( 'Social Icons Widget', 'drizzle-mag' ),
'customize_selective_refresh' => true,
);
$args['fields'] = array(
'title' => array(
'label' => esc_html__( 'Title:', 'drizzle-mag' ),
'type' => 'text',
'class' => 'widefat',
),
);
parent::create_widget( $args );
}
/**
* Echo the widget content.
*
* @since 1.0.0
*
* @param array $args Display arguments including before_title, after_title,
* before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
*/
function widget( $args, $instance ) {
$values = $this->get_field_values( $instance );
$values['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
echo $args['before_widget'];
// Render widget title.
if ( ! empty( $values['title'] ) ) {
echo $args['before_title'] . esc_html( $values['title'] ) . $args['after_title'];
}
if ( has_nav_menu( 'social' ) ) {
wp_nav_menu( array(
'theme_location' => 'social',
'container' => false,
'depth' => 1,
'link_before' => '
',
'link_after' => '',
) );
}
echo $args['after_widget'];
}
}
endif;
if ( ! class_exists( 'drizzle_mag_Recent_Posts_Extended_Widget' ) ) :
/**
* Recent posts extended widget class.
*
* @since 1.0.0
*/
class Drizzle_Mag_Recent_Posts_Extended_Widget extends Drizzle_Mag_Widget_Helper {
/**
* Constructor.
*
* @since 1.0.0
*/
function __construct() {
$args['id'] = 'drizzle-mag-recent-posts-extended';
$args['label'] = esc_html__( 'DM: Recent Posts Extended', 'drizzle-mag' );
$args['widget'] = array(
'classname' => 'drizzle_mag_widget_recent_posts_extended',
'description' => esc_html__( 'Recent posts extended widget', 'drizzle-mag' ),
'customize_selective_refresh' => true,
);
$args['fields'] = array(
'title' => array(
'label' => esc_html__( 'Title:', 'drizzle-mag' ),
'type' => 'text',
'class' => 'widefat',
),
'post_category' => array(
'label' => esc_html__( 'Select Category:', 'drizzle-mag' ),
'type' => 'dropdown-taxonomies',
'show_option_all' => esc_html__( 'All Categories', 'drizzle-mag' ),
),
'post_number' => array(
'label' => esc_html__( 'Number of Posts:', 'drizzle-mag' ),
'type' => 'number',
'default' => 5,
'min' => 1,
'max' => 100,
),
'image_width' => array(
'label' => esc_html__( 'Image Width:', 'drizzle-mag' ),
'type' => 'number',
'description' => esc_html__( 'px', 'drizzle-mag' ),
'default' => 90,
'min' => 1,
'max' => 200,
),
'disable_thumbnail' => array(
'label' => esc_html__( 'Disable Thumbnail', 'drizzle-mag' ),
'type' => 'checkbox',
'default' => false,
),
'disable_date' => array(
'label' => esc_html__( 'Disable Date', 'drizzle-mag' ),
'type' => 'checkbox',
'default' => false,
),
);
parent::create_widget( $args );
}
/**
* Echo the widget content.
*
* @since 1.0.0
*
* @param array $args Display arguments including before_title, after_title,
* before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
*/
function widget( $args, $instance ) {
$values = $this->get_field_values( $instance );
$values['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
echo $args['before_widget'];
// Render widget title.
if ( ! empty( $values['title'] ) ) {
echo $args['before_title'] . esc_html( $values['title'] ) . $args['after_title'];
}
?>
absint( $values['post_number'] ),
'no_found_rows' => true,
'ignore_sticky_posts' => true,
);
if ( absint( $values['post_category'] ) > 0 ) {
$qargs['cat'] = absint( $values['post_category'] );
}
$the_query = new WP_Query( $qargs );
?>
have_posts() ) : ?>
have_posts() ) : $the_query->the_post(); ?>
'drizzle_mag_widget_news_block',
'description' => esc_html__( 'News block Widget', 'drizzle-mag' ),
'customize_selective_refresh' => true,
);
$args['fields'] = array(
'title' => array(
'label' => esc_html__( 'Title:', 'drizzle-mag' ),
'type' => 'text',
'class' => 'widefat',
),
'news_category' => array(
'label' => esc_html__( 'Select Category:', 'drizzle-mag' ),
'type' => 'dropdown-taxonomies',
'show_option_all' => esc_html__( 'All Categories', 'drizzle-mag' ),
),
'news_number' => array(
'label' => esc_html__( 'Number of Posts:', 'drizzle-mag' ),
'type' => 'number',
'default' => 3,
'min' => 1,
'max' => 8,
),
'news_column' => array(
'label' => esc_html__( 'Select Column:', 'drizzle-mag' ),
'type' => 'select',
'default' => 3,
'choices' => array( '1' => 1,'2' => 2, '3' => 3, '4' => 4 ),
),
'news_image' => array(
'label' => esc_html__( 'Select Image:', 'drizzle-mag' ),
'type' => 'select',
'default' => 'drizzle-mag-thumb',
'choices' => drizzle_mag_get_image_sizes_options( false ),
),
'excerpt_length' => array(
'label' => esc_html__( 'Excerpt Length:', 'drizzle-mag' ),
'type' => 'number',
'default' => 12,
'min' => 0,
'max' => 100,
),
'news_layout' => array(
'label' => esc_html__( 'Select News Layout:', 'drizzle-mag' ),
'type' => 'select',
'default' => 2,
'choices' => array( '1' => 1, '2' => 2 ),
),
);
parent::create_widget( $args );
}
/**
* Echo the widget content.
*
* @since 1.0.0
*
* @param array $args Display arguments including before_title, after_title,
* before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
*/
function widget( $args, $instance ) {
$values = $this->get_field_values( $instance );
$values['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
echo $args['before_widget'];
// Render widget title.
if ( ! empty( $values['title'] ) ) {
echo $args['before_title'] . esc_html( $values['title'] ) . $args['after_title'];
}
$qargs = array(
'posts_per_page' => esc_attr( $values['news_number'] ),
'no_found_rows' => true,
'ignore_sticky_posts' => true,
);
if ( absint( $values['news_category'] ) > 0 ) {
$qargs['cat'] = absint( $values['news_category'] );
}
$the_query = new WP_Query( $qargs );
?>
have_posts() ) : ?>
'drizzle_mag_widget_posts_slider',
'description' => esc_html__( 'Posts Slider Widget', 'drizzle-mag' ),
'customize_selective_refresh' => true,
);
$args['fields'] = array(
'title' => array(
'label' => esc_html__( 'Title:', 'drizzle-mag' ),
'type' => 'text',
'class' => 'widefat',
),
'post_category' => array(
'label' => esc_html__( 'Select Category:', 'drizzle-mag' ),
'type' => 'dropdown-taxonomies',
'show_option_all' => esc_html__( 'All Categories', 'drizzle-mag' ),
),
'post_number' => array(
'label' => esc_html__( 'Number of Posts:', 'drizzle-mag' ),
'type' => 'number',
'default' => 4,
'min' => 2,
'max' => 10,
),
'featured_image' => array(
'label' => esc_html__( 'Select Image:', 'drizzle-mag' ),
'type' => 'select',
'default' => 'drizzle-mag-featured',
'choices' => drizzle_mag_get_image_sizes_options( false ),
),
);
parent::create_widget( $args );
}
/**
* Echo the widget content.
*
* @since 1.0.0
*
* @param array $args Display arguments including before_title, after_title,
* before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
*/
function widget( $args, $instance ) {
$values = $this->get_field_values( $instance );
$values['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
echo $args['before_widget'];
// Render widget title.
if ( ! empty( $values['title'] ) ) {
echo $args['before_title'] . esc_html( $values['title'] ) . $args['after_title'];
}
$qargs = array(
'posts_per_page' => absint( $values['post_number'] ),
'no_found_rows' => true,
'meta_key' => '_thumbnail_id',
);
if ( absint( $values['post_category'] ) > 0 ) {
$qargs['cat'] = absint( $values['post_category'] );
}
$the_query = new WP_Query( $qargs );
if ( $the_query->have_posts() ) { ?>
have_posts() ) { ?>
the_post(); ?>
'drizzle_mag_widget_featured_page',
'description' => esc_html__( 'Displays single featured Page', 'drizzle-mag' ),
'customize_selective_refresh' => true,
);
$args['fields'] = array(
'title' => array(
'label' => esc_html__( 'Title:', 'drizzle-mag' ),
'type' => 'text',
'class' => 'widefat',
),
'featured_page' => array(
'label' => esc_html__( 'Select Page:', 'drizzle-mag' ),
'type' => 'dropdown-pages',
'show_option_none' => esc_html__( '— Select —', 'drizzle-mag' ),
),
'content_type' => array(
'label' => esc_html__( 'Show Content:', 'drizzle-mag' ),
'type' => 'select',
'default' => 'full',
'choices' => array(
'short' => esc_html__( 'Short', 'drizzle-mag' ),
'full' => esc_html__( 'Full', 'drizzle-mag' ),
),
),
'excerpt_length' => array(
'label' => esc_html__( 'Excerpt Length:', 'drizzle-mag' ),
'description' => esc_html__( 'Applies when Short is selected in Show Content.', 'drizzle-mag' ),
'type' => 'number',
'default' => 40,
'min' => 1,
'max' => 100,
),
'featured_image' => array(
'label' => esc_html__( 'Select Image:', 'drizzle-mag' ),
'type' => 'select',
'default' => 'medium',
'choices' => drizzle_mag_get_image_sizes_options(),
),
'featured_image_alignment' => array(
'label' => esc_html__( 'Select Image Alignment:', 'drizzle-mag' ),
'type' => 'select',
'default' => 'center',
'choices' => drizzle_mag_get_image_alignment_options(),
),
);
parent::create_widget( $args );
}
/**
* Echo the widget content.
*
* @since 1.0.0
*
* @param array $args Display arguments including before_title, after_title,
* before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
*/
function widget( $args, $instance ) {
$values = $this->get_field_values( $instance );
$values['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
echo $args['before_widget'];
if ( absint( $values['featured_page'] ) > 0 ) {
$qargs = array(
'p' => absint( $values['featured_page'] ),
'post_type' => 'page',
'no_found_rows' => true,
);
$the_query = new WP_Query( $qargs );
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
// Display featured image.
if ( 'disable' !== $values['featured_image'] && has_post_thumbnail() ) {
the_post_thumbnail( esc_attr( $values['featured_image'] ), array( 'class' => 'align' . esc_attr( $values['featured_image_alignment'] ) ) );
}
echo '
';
// Render widget title.
if ( ! empty( $values['title'] ) ) {
echo $args['before_title'] . $values['title'] . $args['after_title'];
}
if ( 'short' === $values['content_type'] ) {
if ( absint( $values['excerpt_length'] ) > 0 ) {
$excerpt = drizzle_mag_get_the_excerpt( absint( $values['excerpt_length'] ) );
echo wp_kses_post( wpautop( $excerpt ) );
echo '
' . esc_html__( 'Read more', 'drizzle-mag' ) . '';
}
} else {
the_content();
}
echo '
';
} // End while.
// Reset.
wp_reset_postdata();
} // End if.
}
echo $args['after_widget'];
}
}
endif;
if ( ! class_exists( 'drizzle_mag_Tabbed_Widget' ) ) :
/**
* Tabbed widget class.
*
* @since 1.0.0
*/
class Drizzle_Mag_Tabbed_Widget extends Drizzle_Mag_Widget_Helper {
/**
* Constructor.
*
* @since 1.0.0
*/
function __construct() {
$args['id'] = 'drizzle-mag-tabbed';
$args['label'] = esc_html__( 'DM: Tabbed', 'drizzle-mag' );
$args['widget'] = array(
'classname' => 'drizzle_mag_widget_tabbed',
'description' => esc_html__( 'Tabbed Widget', 'drizzle-mag' ),
);
$args['fields'] = array(
'popular_heading' => array(
'label' => esc_html__( 'POPULAR', 'drizzle-mag' ),
'type' => 'heading',
),
'popular_number' => array(
'label' => esc_html__( 'No of Posts:', 'drizzle-mag' ),
'type' => 'number',
'default' => 5,
'min' => 1,
'max' => 20,
),
'popular_thumbnail' => array(
'label' => esc_html__( 'Show Thumbnail', 'drizzle-mag' ),
'type' => 'checkbox',
'default' => true,
),
'recent_heading' => array(
'label' => esc_html__( 'RECENT', 'drizzle-mag' ),
'type' => 'heading',
),
'recent_number' => array(
'label' => esc_html__( 'No of Posts:', 'drizzle-mag' ),
'type' => 'number',
'default' => 5,
'min' => 1,
'max' => 20,
),
'recent_thumbnail' => array(
'label' => esc_html__( 'Show Thumbnail', 'drizzle-mag' ),
'type' => 'checkbox',
'default' => true,
),
'comment_heading' => array(
'label' => esc_html__( 'COMMENT', 'drizzle-mag' ),
'type' => 'heading',
),
'comment_number' => array(
'label' => esc_html__( 'No of Comments:', 'drizzle-mag' ),
'type' => 'number',
'default' => 5,
'min' => 1,
'max' => 20,
),
'comment_thumbnail' => array(
'label' => esc_html__( 'Show Thumbnail', 'drizzle-mag' ),
'type' => 'checkbox',
'default' => true,
),
);
parent::create_widget( $args );
}
/**
* Echo the widget content.
*
* @since 1.0.0
*
* @param array $args Display arguments including before_title, after_title,
* before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
*/
function widget( $args, $instance ) {
$values = $this->get_field_values( $instance );
$instance_number = $this->number;
echo $args['before_widget'];
?>
absint( $values['popular_number'] ),
'orderby' => 'comment_count',
'no_found_rows' => true,
'ignore_sticky_posts' => true,
);
$the_query = new WP_Query( $qargs );
?>
have_posts() ) : ?>
have_posts() ) : $the_query->the_post(); ?>
absint( $values['recent_number'] ),
'no_found_rows' => true,
'ignore_sticky_posts' => true,
);
$the_query = new WP_Query( $qargs );
?>
have_posts() ) : ?>
have_posts() ) : $the_query->the_post(); ?>
absint( $values['comment_number'] ),
'post_type' => 'post',
'status' => 'approve',
);
$comments_query = new WP_Comment_Query;
$comments = $comments_query->query( $qargs );
?>
comment_author ); ?> comment_author ); ?> comment_post_ID ) > 0 ) : ?> comment_post_ID ) ); ?>