__( 'Display recent changelog entries.', 'pc-changelog-manager-abc123' ), 'customize_selective_refresh' => true, ) ); } /** * Output the widget content. * * @param array $args Display arguments. * @param array $instance Widget instance. */ public function widget( $args, $instance ) { // Enqueue styles. if ( file_exists( PC_CLM_PLUGIN_DIR . 'public/css/public-style.css' ) ) { wp_enqueue_style( 'pc-clm-public-style', PC_CLM_PLUGIN_URL . 'public/css/public-style.css', array(), PC_CLM_VERSION ); } $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Changelog', 'pc-changelog-manager-abc123' ); $limit = ! empty( $instance['limit'] ) ? intval( $instance['limit'] ) : 5; $show_date = ! empty( $instance['show_date'] ) ? $instance['show_date'] : 'yes'; $show_category = ! empty( $instance['show_category'] ) ? $instance['show_category'] : 'yes'; echo wp_kses_post( $args['before_widget'] ); if ( $title ) { echo wp_kses_post( $args['before_title'] . apply_filters( 'widget_title', $title ) . $args['after_title'] ); } // Query changelog entries. $query_args = array( 'post_type' => 'pc_changelog', 'post_status' => 'publish', 'posts_per_page' => $limit, 'orderby' => 'date', 'order' => 'DESC', ); $query = new WP_Query( $query_args ); if ( $query->have_posts() ) { ?>

/>

/>