Please select your page with ctrl or command key press.
';
}
else
echo 'No posts found :(';
}
/**
* Renders the output.
*
* @see WP_Widget::widget()
*/
public function widget( $args, $instance )
{
global $wp_query;
print $args['before_widget'];
print !empty( $args['after_title'] ) ? $args['after_title'] : '';
if( $instance['select'] != '' and ! is_array( $instance['select'] ) ){ $instance['select'] = array( $instance['select'] ); }
if( is_array( $instance['select'] ) ) {
print '';
foreach( $instance['select'] as $key => $value ){
if( $wp_query->get_queried_object_id() === (int) absint($value) ){
$service_class = 'class="active"';
}else{ $service_class = ''; }
printf( '- %3$s
', $service_class, get_page_link($value), get_the_title($value) );
} print '
';
}
print $args['after_widget'];
}
/**
* Prepares the content. Not.
*
* @param array $new_instance New content
* @param array $old_instance Old content
* @return array New content
*/
public function update( $new_instance, $old_instance )
{
$instance = $old_instance;
$instance['select'] = esc_sql( $new_instance['select'] );
return $instance;
}
/**
* Tell WP we want to use this widget.
*
* @wp-hook widgets_init
* @return void
*/
public static function register(){
register_widget( __CLASS__ );
}
}