HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: /var/www/kevin-demo/wp-content/themes/fitmencook/template-parts/blog-sidebar.php
<div class="fmc_post_sidebar">
    <h3 class="spacing_0_3"><?php the_field('editors_choice_title', 'option'); ?></h3>
    <div class="fmc_blog_sidebar_grid">
        <?php
        // latest recipes query
        $args = array(
            'posts_per_page'   => 3,
            'post_type'        => 'post',
        );

        $the_query = new WP_Query( $args ); ?>
        <?php if( $the_query->have_posts() ): ?>
            <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                <div class="fmc_post">
                    <figure class="fmc_grid_figure">
                        <a href="<?php the_permalink(); ?>">
                            <?php the_post_thumbnail('medium'); ?>
                        </a>
                    </figure>
                    <div class="fmc_post_content">
                        <span class="fmc_grid_cat">
                            <?php 
                            $categories = get_the_category();
                            if ( ! empty( $categories ) ) {
                                foreach( $categories as $category ) {
                                    echo '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" class="fmc_category_link">' . esc_html( $category->name ) . '</a> ';
                                }
                            }
                            ?>
                        </span>
                        <h3 class="fmc_grid_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                        <!-- <p class="fmc_post_excerpt"><?php // echo wp_trim_words( get_the_excerpt(), 20 ); ?></p> -->
                    </div>
                </div>
            <?php endwhile; ?>
        <?php endif; ?>

        <?php wp_reset_query(); ?>
    </div>
    <h3 class="spacing_0_3"><?php the_field('latest_blogs_title', 'option'); ?></h3>

    <div class="fmc_blog_sidebar_grid">
        <?php
        $editors_choice = get_field('editors_choice', 'option');
        if( $editors_choice ): ?>
            <?php foreach( $editors_choice as $post ): 
                setup_postdata($post); ?>
                <div class="fmc_post">
                    <figure class="fmc_grid_figure">
                        <a href="<?php the_permalink(); ?>">
                            <?php the_post_thumbnail('thumbnail'); ?>
                        </a>
                    </figure>
                    <div class="fmc_post_content">
                        <span class="fmc_grid_cat">
                            <?php 
                            $categories = get_the_category();
                            if ( ! empty( $categories ) ) {
                                foreach( $categories as $category ) {
                                    echo '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" class="fmc_category_link">' . esc_html( $category->name ) . '</a> ';
                                }
                            }
                            ?>
                        </span>
                        <h3 class="fmc_grid_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                        <!-- <p class="fmc_post_excerpt"><?php // echo wp_trim_words( get_the_excerpt(), 20 ); ?></p> -->
                    </div>
                </div>
            <?php endforeach; ?>
            <?php wp_reset_postdata(); ?>
        <?php endif; ?>
    </div>

    <!-- Section to display all blog categories -->
    <div class="fmc_blog_categories_wrapper">
        <h3 class="spacing_0_3">All Categories</h3>
        <div class="fmc_blog_sidebar_categories">
            <?php 
            $categories = get_categories();
            foreach( $categories as $category ) {
                echo '<div class="fmc_category_item">';
                echo '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" class="fmc_category_link">';
                echo esc_html( $category->name ) . ' (' . $category->count . ')';
                echo '</a>';
                echo '</div>';
            }
            ?>
        </div>
    </div>
</div>