first commit
This commit is contained in:
141
wp-content/plugins/em-helper-plugin/widgets/em_about.php
Normal file
141
wp-content/plugins/em-helper-plugin/widgets/em_about.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
// About us widget for footer
|
||||
add_action('widgets_init', 'cyber_about_us_widgets');
|
||||
|
||||
if(!function_exists('cyber_about_us_widgets')){
|
||||
|
||||
function cyber_about_us_widgets(){
|
||||
|
||||
register_widget('cyber_about_us_Widget');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!class_exists('cyber_about_us_Widget')){
|
||||
|
||||
class cyber_about_us_Widget extends WP_Widget {
|
||||
|
||||
public function __construct(){
|
||||
$widget_ops = array('classname' => 'about_us', 'description' => '');
|
||||
$control_ops = array('id_base' => 'about_us-widget');
|
||||
parent::__construct('about_us-widget', 'EM Address Widget', $widget_ops, $control_ops);
|
||||
}
|
||||
public function widget($args, $instance){
|
||||
extract($args);
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
echo $args['before_widget'];
|
||||
if($title) {
|
||||
echo $args['before_title'] . $title . $args['after_title'];
|
||||
}
|
||||
?>
|
||||
<!-- About Widget -->
|
||||
<div class="about-footer">
|
||||
<div class="footer-widget address">
|
||||
<div class="footer-logo">
|
||||
<?php if(!empty($instance['image_uri']) && isset($instance['image_uri'])): ?>
|
||||
<img src="<?php echo esc_url($instance['image_uri']); ?>" alt="">
|
||||
<?php endif; ?>
|
||||
<?php if(!empty($instance['content']) && isset($instance['content'])): ?>
|
||||
<p><?php echo $instance['content']; ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="footer-address">
|
||||
<?php if(!empty($instance['address1']) && isset($instance['address1'])): ?>
|
||||
<div class="footer_s_inner">
|
||||
<div class="footer-sociala-icon">
|
||||
<i class="fa fa-home"></i>
|
||||
</div>
|
||||
<div class="footer-sociala-info">
|
||||
<p><?php echo $instance['address1']; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if(!empty($instance['telephone']) && isset($instance['telephone'])): ?>
|
||||
<div class="footer_s_inner">
|
||||
<div class="footer-sociala-icon">
|
||||
<i class="fa fa-phone"></i>
|
||||
</div>
|
||||
<div class="footer-sociala-info">
|
||||
<p><?php echo $instance['telephone']; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if(!empty($instance['email']) && isset($instance['email'])): ?>
|
||||
<div class="footer_s_inner">
|
||||
<div class="footer-sociala-icon">
|
||||
<i class="fa fa-globe"></i>
|
||||
</div>
|
||||
<div class="footer-sociala-info">
|
||||
<p><?php echo $instance['email']; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
echo $args['after_widget'];
|
||||
}
|
||||
|
||||
|
||||
public function update($new_instance, $old_instance){
|
||||
|
||||
$instance = $old_instance;
|
||||
$instance['title'] = $new_instance['title'];
|
||||
$instance['content'] = $new_instance['content'];
|
||||
$instance['image_uri'] = $new_instance['image_uri'];
|
||||
$instance['address1'] = $new_instance['address1'];
|
||||
$instance['telephone'] = $new_instance['telephone'];
|
||||
$instance['email'] = $new_instance['email'];
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
public function form($instance){
|
||||
|
||||
$defaults = array('title' => '', 'content' => 'Lorem ipsum dolor sit amet, consetur acing elit, sed do eiusmod ligal', 'image_uri' => '','address1' => '1245 Rang Raod,<br>medical, E152 95RB','telephone' => 'Telephone : (922) 3354 2252<br>Telephone : (922) 3354 2252','email' => 'admin@raytheme.com<br>Web : www.raytheme.com');
|
||||
|
||||
$instance = wp_parse_args((array) $instance, $defaults); ?>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:','cyber');?></label>
|
||||
<input class="widefat" type="text" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" value="<?php echo esc_attr($instance['title']); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label style="display:block;" for="<?php echo esc_attr($this->get_field_id('image_uri')); ?>"><?php esc_html_e('Upload Image:','cyber');?></label>
|
||||
|
||||
<img class="custom_media_image" src="<?php if(!empty($instance['image_uri'])){echo $instance['image_uri'];} ?>" style="margin:0;padding:0;max-width:100px;display:inline-block" />
|
||||
|
||||
<input type="text" class="widefat custom_media_url" name="<?php echo esc_attr($this->get_field_name('image_uri')); ?>" id="<?php echo esc_attr($this->get_field_id('image_uri')); ?>" value="<?php echo esc_attr($instance['image_uri']); ?>">
|
||||
<a href="#" id="custom_media_button" style="margin-top:10px;" class="button button-primary custom_media_button"><?php esc_html_e('Upload', 'cyber'); ?></a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
<label for="<?php echo esc_attr($this->get_field_id('content')); ?>"><?php esc_html_e('About Text:','cyber');?></label>
|
||||
<textarea class="widefat" rows="5" type="text" id="<?php echo esc_attr($this->get_field_id('content')); ?>" name="<?php echo esc_attr($this->get_field_name('content')); ?>" ><?php echo $instance['content']; ?></textarea>
|
||||
<span> <b><?php esc_html_e('Note:','cyber');?></b><?php esc_html_e('use','cyber');?> <b> <br> </b><?php esc_html_e(' for line break.','cyber');?></span>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr($this->get_field_id('address1')); ?>"><?php esc_html_e('Address:','cyber');?></label>
|
||||
<input class="widefat" type="text" id="<?php echo esc_attr($this->get_field_id('address1')); ?>" name="<?php echo esc_attr($this->get_field_name('address1')); ?>" value="<?php echo esc_attr($instance['address1']); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr($this->get_field_id('telephone')); ?>"><?php esc_html_e('Telephone:','cyber');?></label>
|
||||
<input class="widefat" type="text" id="<?php echo esc_attr($this->get_field_id('telephone')); ?>" name="<?php echo esc_attr($this->get_field_name('telephone')); ?>" value="<?php echo esc_attr($instance['telephone']); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr($this->get_field_id('email')); ?>"><?php esc_html_e('Email & Web:','cyber');?></label>
|
||||
<input class="widefat" type="text" id="<?php echo esc_attr($this->get_field_id('email')); ?>" name="<?php echo esc_attr($this->get_field_name('email')); ?>" value="<?php echo esc_attr($instance['email']); ?>" />
|
||||
</p>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/**
|
||||
* Widget em Recent Posts
|
||||
*/
|
||||
// Register and load the widget
|
||||
function em_load_portfolio_widget() {
|
||||
|
||||
register_widget( 'em_recent_portfolio_widget' );
|
||||
|
||||
}
|
||||
add_action( 'widgets_init', 'em_load_portfolio_widget' );
|
||||
|
||||
class em_recent_portfolio_widget extends WP_Widget {
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constructor
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
public function __construct() {
|
||||
$widget_ops = array(
|
||||
'classname' => 'widget_recent_port_data',
|
||||
'description' => esc_html__( 'The most recent portfolio on your site.', 'cyber' ),
|
||||
'customize_selective_refresh' => true,
|
||||
);
|
||||
parent::__construct( 'em_recent_portfolio_widget', esc_html__( 'EM Recent Portfolio','cyber' ), $widget_ops );
|
||||
$this->alt_option_name = 'widget_recent_port_data';
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Outputs the HTML for this widget.
|
||||
* --------------------------------------------------------------------------- */
|
||||
public function widget( $args, $instance ) {
|
||||
|
||||
if ( ! isset( $args['widget_id'] ) ) $args['widget_id'] = null;
|
||||
extract( $args, EXTR_SKIP );
|
||||
|
||||
echo $before_widget;
|
||||
|
||||
$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base);
|
||||
|
||||
?>
|
||||
<div class="single-portfolio-recent-item">
|
||||
<?php if( $title ) echo $before_title . $title . $after_title;?>
|
||||
<div class="recent-portfolio-area">
|
||||
<?php
|
||||
$args = array(
|
||||
'posts_per_page' => $instance['count'] ? intval($instance['count']) : 0,
|
||||
'post_type' =>'em_portfolio',
|
||||
'no_found_rows' => true,
|
||||
'post_status' => 'publish',
|
||||
'ignore_sticky_posts' => true
|
||||
);
|
||||
$r = new WP_Query( apply_filters( 'widget_posts_args', $args ) );
|
||||
|
||||
if ($r->have_posts()){
|
||||
while ( $r->have_posts() ){
|
||||
$r->the_post();
|
||||
|
||||
?>
|
||||
|
||||
<div class="recent-portfolio">
|
||||
<div class="recent-portfolio-image">
|
||||
<?php if( has_post_thumbnail( get_the_ID() ) ){?>
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>">
|
||||
|
||||
<?php echo get_the_post_thumbnail( get_the_ID(), 'cyber_recent_image' );?>
|
||||
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php }?>
|
||||
<?php
|
||||
wp_reset_postdata();
|
||||
|
||||
}?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
echo $after_widget;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Deals with the settings when they are saved by the admin.
|
||||
* --------------------------------------------------------------------------- */
|
||||
public function update( $new_instance, $old_instance ) {
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags( $new_instance['title'] );
|
||||
$instance['count'] = (int) $new_instance['count'];
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Displays the form for this widget on the Widgets page of the WP Admin area.
|
||||
* --------------------------------------------------------------------------- */
|
||||
public function form( $instance ) {
|
||||
|
||||
$title = isset( $instance['title']) ? esc_attr( $instance['title'] ) : '';
|
||||
$count = isset( $instance['count'] ) ? absint( $instance['count'] ) : 6;
|
||||
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'cyber' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>"><?php esc_html_e( 'Number of posts:', 'cyber' ); ?></label>
|
||||
<input id="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'count' ) ); ?>" type="text" value="<?php echo esc_attr( $count ); ?>" size="4"/>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
127
wp-content/plugins/em-helper-plugin/widgets/em_recent_post.php
Normal file
127
wp-content/plugins/em-helper-plugin/widgets/em_recent_post.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/**
|
||||
* Widget em Recent Posts
|
||||
*/
|
||||
// Register and load the widget
|
||||
function em_load_widget() {
|
||||
|
||||
register_widget( 'em_recent_post_widget' );
|
||||
|
||||
}
|
||||
add_action( 'widgets_init', 'em_load_widget' );
|
||||
|
||||
class em_recent_post_widget extends WP_Widget {
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constructor
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
public function __construct() {
|
||||
$widget_ops = array(
|
||||
'classname' => 'widget_recent_data',
|
||||
'description' => esc_html__( 'The most recent posts on your site.', 'cyber' ),
|
||||
'customize_selective_refresh' => true,
|
||||
);
|
||||
parent::__construct( 'em_recent_post_widget', esc_html__( 'EM Recent Posts','cyber' ), $widget_ops );
|
||||
$this->alt_option_name = 'widget_recent_data';
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Outputs the HTML for this widget.
|
||||
* --------------------------------------------------------------------------- */
|
||||
public function widget( $args, $instance ) {
|
||||
|
||||
if ( ! isset( $args['widget_id'] ) ) $args['widget_id'] = null;
|
||||
extract( $args, EXTR_SKIP );
|
||||
|
||||
echo $before_widget;
|
||||
|
||||
$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base);
|
||||
|
||||
?>
|
||||
<div class="single-widget-item">
|
||||
<?php if( $title ) echo $before_title . $title . $after_title;?>
|
||||
<?php
|
||||
$args = array(
|
||||
'posts_per_page' => $instance['count'] ? intval($instance['count']) : 0,
|
||||
'no_found_rows' => true,
|
||||
'post_status' => 'publish',
|
||||
'ignore_sticky_posts' => true
|
||||
);
|
||||
$r = new WP_Query( apply_filters( 'widget_posts_args', $args ) );
|
||||
|
||||
if ($r->have_posts()){
|
||||
while ( $r->have_posts() ){
|
||||
$r->the_post();
|
||||
|
||||
?>
|
||||
<div class="recent-post-item">
|
||||
<div class="recent-post-image">
|
||||
<?php if( has_post_thumbnail( get_the_ID() ) ){?>
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>">
|
||||
|
||||
<?php echo get_the_post_thumbnail( get_the_ID(), 'cyber-recent-image' );?>
|
||||
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<div class="recent-post-text">
|
||||
<h4><a href="<?php echo esc_url( get_permalink() ); ?>">
|
||||
<?php
|
||||
if ( function_exists( 'cyber_title' ) ){
|
||||
cyber_title(7);
|
||||
}
|
||||
?>
|
||||
</a></h4>
|
||||
<span class="rcomment"><?php echo get_the_time(get_option('date_format'));?></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php
|
||||
wp_reset_postdata();
|
||||
|
||||
}?>
|
||||
</div>
|
||||
<?php
|
||||
echo $after_widget;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Deals with the settings when they are saved by the admin.
|
||||
* --------------------------------------------------------------------------- */
|
||||
public function update( $new_instance, $old_instance ) {
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags( $new_instance['title'] );
|
||||
$instance['count'] = (int) $new_instance['count'];
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Displays the form for this widget on the Widgets page of the WP Admin area.
|
||||
* --------------------------------------------------------------------------- */
|
||||
public function form( $instance ) {
|
||||
|
||||
$title = isset( $instance['title']) ? esc_attr( $instance['title'] ) : '';
|
||||
$count = isset( $instance['count'] ) ? absint( $instance['count'] ) : 2;
|
||||
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'cyber' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>"><?php esc_html_e( 'Number of posts:', 'cyber' ); ?></label>
|
||||
<input id="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'count' ) ); ?>" type="text" value="<?php echo esc_attr( $count ); ?>" size="4"/>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user