<?php
// Simple Fields (text, select, date, number, etc.)
?>
<?php if ( sifency_has_field( 'portfolio_client_name' ) ) : ?>
    <h3>Client: <?php sifency_the_field( 'portfolio_client_name' ); ?></h3>
<?php endif; ?>

<?php
// To get the value into a variable (useful in Elementor widgets)
$sifency_timeline = sifency_get_field( 'portfolio_duration' );
echo '<p>Timeline: ' . esc_html( $sifency_timeline ) . '</p>';
?>

<?php // WP Editor / Textarea with HTML ?>
<div class="project-description">
    <?php sifency_the_content_field( 'portfolio_short_description' ); ?>
</div>


<?php // Media / Image Field ?>
<?php if ( sifency_has_field( 'event_featured_image' ) ) : ?>
    <div class="event-banner">
        <?php
        // Display the full <img> tag with a custom class
        sifency_the_image_field( 'event_featured_image', null, 'large', [ 'class' => 'event-banner-img' ] );
        ?>
    </div>
<?php endif; ?>

<?php // Get just the URL for a background image
$sifency_bg_image_url = sifency_get_attachment_url( 'event_featured_image' );
?>
<div style="background-image: url('<?php echo esc_attr( esc_url( $sifency_bg_image_url ) ); ?>');"></div>

<?php // upload ?>
<?php if ( sifency_has_field( 'service_file_upload' ) ) : ?>
    <a href="<?php echo esc_url ( sifency_get_attachment_url( 'service_file_upload' ) ); ?>" class="button" download>
        Download Brochure
    </a>
<?php endif; ?>


<?php // link field ?>
<?php if ( sifency_has_field( 'portfolio_website' ) ) : ?>
    <div class="project-link">
        <?php
        sifency_the_link_field( 'portfolio_website', null, [
            'text'    => 'View Live Project',
            'class'   => 'button-primary',
            'new_tab' => true,
        ] );
        ?>
    </div>
<?php endif; ?>


<?php
// pricing repeater example
$sifency_pricing_groups = sifency_get_field( 'menu_item_pricing' );

if ( ! empty( $sifency_pricing_groups ) ) : ?>
    <ul class="pricing-list">
        <?php foreach ( $sifency_pricing_groups as $sifency_group ) : ?>
            <li>
                <?php if ( ! empty( $sifency_group['size'] ) ) : ?>
                    <span class="price-size"><?php echo esc_html( $sifency_group['size'] ); ?></span>
                <?php endif; ?>
                <span class="price-amount"><?php echo esc_html( $sifency_group['price'] ); ?></span>
            </li>
        <?php endforeach; ?>
    </ul>
<?php endif; ?>


<?php

// menu item labels (checkboxes)
$sifency_labels = sifency_get_field( 'menu_item_labels' );

if ( ! empty( $sifency_labels ) ) : ?>
    <div class="dietary-labels">
        <?php foreach ( $sifency_labels as $sifency_label ) : ?>
            <span class="label-<?php echo esc_attr( $sifency_label ); ?>">
                <?php echo esc_html( ucwords( str_replace( '_', ' ', $sifency_label ) ) ); ?>
            </span>
        <?php endforeach; ?>
    </div>
<?php endif; ?>

<?php
// You can also check for a specific value
if ( is_array($sifency_labels) && in_array( 'gluten_free', $sifency_labels ) ) {
    echo '<p>This item is Gluten-Free!</p>';
}
?>