PATH:
var
/
www
/
vhosts
/
sandbox.dos-group.com
/
httpdocs
/
hotelcoronado
/
wp-content
/
themes
/
hotelcoronado
/
admin
<?php /* ----------------------------------- ** NEW PACKAGES FEATURED WIDGET ** -------------------------------------- */ //WIDGET CHE MI MOSTRERA' GLI ULTIMI PACCHETTI/OFFERTE AGGIUNTE class Packages_Featured_Widget extends WP_Widget { public function __construct() { parent::__construct( 'packages-featured-widget', 'Packages Widget', array( 'description' => __( 'Mostra le ultime offerte/pacchetti','coronado' ) ) ); } public function form( $instance ) { $title = ( isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : __( 'Pacchetti e Offerte', 'coronado' ) ); $max_posts = ( isset( $instance[ 'max_posts' ] ) ? $instance[ 'max_posts' ] : 5 ); ?> <p> <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Titolo', 'coronado' ); ?>:</label> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>"> </p> <p> <label for="<?php echo $this->get_field_id( 'max_posts' ); ?>"><?php _e( 'Numero di articoli da visualizzare', 'coronado' ); ?>:</label> <input class="widefat" id="<?php echo $this->get_field_id( 'max_posts' ); ?>" name="<?php echo $this->get_field_name( 'max_posts' ); ?>" type="text" value="<?php echo esc_attr( $max_posts ); ?>"> </p> <?php } public function update( $new_instance, $old_instance ) { $instance = array(); $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : ''; $instance['max_posts'] = $new_instance['max_posts']; return $instance; } public function widget( $args, $instance ) { extract( $args ); $title = apply_filters( 'widget_title', $instance['title'] ); $max_posts = apply_filters( 'widget_title', $instance['max_posts'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; $args = array( 'post_type' => 'packages', 'posts_per_page' => $max_posts ); $packs = new WP_Query( $args ); ?> <div class="widget_featured text-right"> <ul class="list-unstyled"> <?php if ( $packs->have_posts() ) : while ( $packs->have_posts() ) : $packs->the_post(); ?> <li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li> <?php endwhile; endif; ?> </ul> </div> <!-- /widget_featured --> <?php wp_reset_postdata(); echo $after_widget; } } register_widget( 'Packages_Featured_Widget' );
[+]
images
[+]
classes
[-] widgets.php
[open]
[+]
assets
[+]
functions
[-] init.php
[open]
[+]
..
[-] shortcodes.php
[open]
[-] cuztom.php
[open]