/*
Theme Name: Astra Child
Theme URI: https://wpastra.com/
Template: astra
Author: Brainstorm Force
Author URI: https://wpastra.com/about/?utm_source=theme_preview&utm_medium=author_link&utm_campaign=astra_theme
Description: The Astra WordPress theme is lightning-fast and highly customizable. It has over 1 million downloads and the only theme in the world with 6,000+ five-star reviews! It’s ideal for professional web designers, solopreneurs, small businesses, eCommerce, membership sites and any type of website. It offers special features and templates so it works perfectly with all page builders like Spectra, Elementor, Beaver Builder, etc. Fast performance, clean code, mobile-first design and schema markup are all built-in, making the theme exceptionally SEO-friendly. It’s fully compatible with WooCommerce, SureCart and other eCommerce plugins and comes with lots of store-friendly features and templates. Astra also provides expert support for free users. A dedicated team of fully trained WordPress experts are on hand to help with every aspect of the theme. Try the live demo of Astra: https://zipwp.org/themes/astra/
Tags: custom-menu,custom-logo,entertainment,one-column,two-columns,left-sidebar,e-commerce,right-sidebar,custom-colors,editor-style,featured-images,full-width-template,microformats,post-formats,rtl-language-support,theme-options,threaded-comments,translation-ready,blog
Version: 4.13.5.1783347517
Updated: 2026-07-06 17:18:37

*/
/* كود عرض احدث المقالات في الفوتر */
function elite_footer_posts_with_images() {
    $query = new WP_Query(array(
        'posts_per_page' => 3,
        'post_status'    => 'publish'
    ));

    $output = '<div class="footer-posts-wrapper" style="direction: rtl; font-family: \'Readex Pro\', sans-serif;">';

    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            $thumbnail = get_the_post_thumbnail_url(get_the_ID(), 'thumbnail');
            // صورة افتراضية في حال عدم وجود صورة للمقال
            if (!$thumbnail) {
                $thumbnail = 'https://via.placeholder.com/60'; 
            }

            $output .= '<div style="display: flex; align-items: center; margin-bottom: 15px; border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom: 10px;">';
            
            // عرض الصورة
            $output .= '<div style="flex-shrink: 0; margin-left: 15px;">';
            $output .= '<a href="' . get_permalink() . '">';
            $output .= '<img src="' . $thumbnail . '" alt="' . get_the_title() . '" style="width: 60px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid #eee;">';
            $output .= '</a>';
            $output .= '</div>';

            // عرض العنوان
            $output .= '<div style="flex-grow: 1;">';
            $output .= '<a href="' . get_permalink() . '" style="color: #333; text-decoration: none; font-size: 0.9rem; line-height: 1.4; transition: 0.3s; display: block;" onmouseover="this.style.color=\'#B88A44\'" onmouseout="this.style.color=\'#333\'">';
            $output .= get_the_title();
            $output .= '</a>';
            $output .= '</div>';

            $output .= '</div>';
        }
        wp_reset_postdata();
    } else {
        $output .= '<p>لا توجد مقالات حالياً</p>';
    }

    $output .= '</div>';
    return $output;
}
add_shortcode('latest_footer_posts_img', 'elite_footer_posts_with_images');



