'post', 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'no_found_rows' => true, 'post__not_in' => $exclude_current && is_singular( 'post' ) ? array( (int) get_the_ID() ) : array(), 'meta_query' => array( array( 'key' => '_thumbnail_id', 'compare' => 'EXISTS' ) ), ) ); if ( ! $jq->have_posts() ) { return; } require_once dirname( __DIR__ ) . '/class-aieo-journal.php'; echo AIEO_Journal::section( $jq->posts, array( 'heading' => (string) ( $attributes['secHeading'] ?? '' ), 'level' => (int) ( $attributes['level'] ?? 2 ), 'all_text' => (string) ( $attributes['allText'] ?? '' ), 'all_href' => (string) ( $attributes['allHref'] ?? '' ), 'show_all' => ! isset( $attributes['showAll'] ) || (bool) $attributes['showAll'], 'wrapper' => array( 'class' => 'aieo-latest-posts-overlay aieo-journal', 'data-rooster-ui' => 'rooster-one/latest-posts-overlay', ), ) ); return; } if ( ! class_exists( 'AIEO_Block_Header' ) && defined( 'AIEO_DIR' ) ) { $hp = AIEO_DIR . 'includes/class-aieo-block-header.php'; if ( is_file( $hp ) ) { require_once $hp; } } $args = array( 'post_type' => 'post', 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'no_found_rows' => true, ); if ( $exclude_current && is_singular( 'post' ) ) { $current = (int) get_the_ID(); if ( $current > 0 ) { $args['post__not_in'] = array( $current ); } } $q = new WP_Query( $args ); if ( ! $q->have_posts() ) { return; } $wrapper_cls = 'aieo-latest-posts-overlay aieo-latest-posts-overlay--' . $card_style; $wrapper_attrs = get_block_wrapper_attributes( array( 'class' => $wrapper_cls ) ); $header_html = class_exists( 'AIEO_Block_Header' ) ? AIEO_Block_Header::render( $attributes ) : ''; ob_start(); ?>
>
have_posts() ) : $q->the_post(); if ( ! has_post_thumbnail() ) { continue; } $thumb_id = get_post_thumbnail_id( get_the_ID() ); $thumb = wp_get_attachment_image_src( $thumb_id, $image_size ); if ( ! $thumb ) { continue; } $img_url = $thumb[0]; $img_w = (int) ( $thumb[1] ?? 416 ); $img_h = (int) ( $thumb[2] ?? 333 ); $title = get_the_title(); $permalink = get_the_permalink(); $cats = get_the_category(); $cat_name = ''; $cat_link = ''; if ( ! empty( $cats ) ) { $first = $cats[0]; $cat_name = $first->name; $cat_link = (string) get_category_link( $first->term_id ); } ?>