comment_count; if ($count < 1) { return ''; } return sprintf( /* translators: %s: number of comments. */ _n('%s comment', '%s comments', $count, 'inaikas-posts-widget'), number_format_i18n($count) ); } /** * Render the list of posts. * * Returns an empty string when there is nothing to show, so the widget never * prints an empty box. * * @param array $args Parsed or raw settings. * @return string */ function tdd_posts_widget_render_list($args) { $args = tdd_posts_widget_parse_args($args); $posts = tdd_posts_widget_query_posts($args); if (empty($posts)) { return ''; } // The stylesheet is registered on wp_enqueue_scripts. Enqueuing it here as // well covers shortcodes printed after the head, such as Elementor blocks. tdd_posts_widget_enqueue_style(); $columns = (int) $args['columns']; $layout = $columns > 1 ? 'grid' : 'list'; $classes = array( 'tdd-posts-widget', 'tdd-posts-widget--source-' . $args['source'], 'tdd-posts-widget--' . $layout, 'tdd-posts-widget--columns-' . $columns, ); ob_start(); ?>