/** * 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) { global $wpcu_wpfn; if (!class_exists("wpcuWPFnProPlugin") && $wpcu_wpfn->widget_count++ > 0) { return false; } echo $args['before_widget']; /* * if( $widget_id = $args['widget'] ) { $widget = get_post( $widget_id ); $widget->settings = get_post_meta( $widget->ID, '_wpcufpn_settings', true ); if( !empty( $widget->settings ) ) { $front = new wpcuFPN_Front( $widget ); $front->loadThemeStyle(); $html .= $front->display( false ); } else { $html .= "\n<!-- WPFN: this News Widget is not initialized -->\n"; } } * */ $widget = get_post($instance['news_widget_id']); if (isset($widget) && !empty($widget)) { $widget->settings = get_post_meta($widget->ID, '_wpcufpn_settings', true); $front = new wpcuFPN_Front($widget); //$front->loadThemeStyle(); if (isset($front->widget->settings['show_title']) && $front->widget->settings['show_title'] == 1) { echo $args['before_title'] . $front->widget->post_title . $args['after_title']; } $front->display(true, true); echo $args['after_widget']; } }
/** * 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) { global $wpcu_wpfn; if (!class_exists(wpcuWPFnProPlugin) && $wpcu_wpfn->widget_count++ > 0) { return false; } echo $args['before_widget']; $widget = get_post($instance['news_widget_id']); $widget->settings = get_post_meta($widget->ID, '_wpcufpn_settings', true); $front = new wpcuFPN_Front($widget); if (isset($front->widget->settings['show_title']) && $front->widget->settings['show_title'] == 1) { echo $args['before_title'] . $front->widget->post_title . $args['after_title']; } $front->display(true, true); echo $args['after_widget']; }
/** * Returns content of our shortcode * */ public function applyShortcode($args = array()) { $html = ''; if ($widget_id = $args['widget']) { $widget = get_post($widget_id); $widget->settings = get_post_meta($widget->ID, '_wpcufpn_settings', true); if (!empty($widget->settings)) { $front = new wpcuFPN_Front($widget); $html .= $front->display(false); } else { $html .= "\n<!-- WPFN: this News Widget is not initialized -->\n"; } } return $html; }