__('Displays one of your Widget Blocks.', 'wysiwyg-widgets') ) // Args ); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget( $args, $instance ) { $id = ($instance['wysiwyg-widget-id']) ? $instance['wysiwyg-widget-id'] : 0; $show_title = (isset($instance['show_title'])) ? $instance['show_title'] : 1; $post = get_post( $id ); echo $args['before_widget']; if( ! empty( $id ) && $post ) { // Allow filtering of content $content = apply_filters( 'ww_content', $post->post_content, $id ); printf( '', WYWI_VERSION_NUMBER ); if( $show_title ) { // first check $instance['title'] so titles are not changed for people upgrading from an older version of the plugin // titles WILL change when they re-save their widget.. $title = ( isset( $instance['title'] ) ) ? $instance['title'] : $post->post_title; $title = apply_filters( 'widget_title', $title ); echo $args['before_title'] . $title . $args['after_title']; } echo $content; echo ''; } elseif( current_user_can( 'manage_options' ) ) { ?>

'wysiwyg-widget', 'numberposts' => -1 )); $show_title = ( isset( $instance['show_title'] ) ) ? $instance['show_title'] : 1; $selected_widget_id = ( isset( $instance['wysiwyg-widget-id'] ) ) ? $instance['wysiwyg-widget-id'] : 0; $title = ($selected_widget_id) ? get_the_title( $selected_widget_id ) : 'No widget block selected.'; ?>

', '' ); ?>