<?php
/**
 * Template Name: About Us Template
 *
 * @package WordPress
 */
__('About Us Template', TEXT_DOMAIN);

$imageLg = get_option(TEXT_DOMAIN . '_about_image_lg');
$imageSm = get_option(TEXT_DOMAIN . '_about_image_sm');
$imageText = get_option(TEXT_DOMAIN . '_about_image_text');
$showShareButtons = get_option(TEXT_DOMAIN . '_about_share_buttons') === 'true';
?>
<?php get_header(); ?>
<?php if (have_posts()): ?><?php while (have_posts()): the_post(); ?>

    <main>

        <div class="mt-4 mb-5">
            <div class="custom-container">

                <!-- page content -->
                <div class="single-box single-box-contact-image <?php echo !empty($imageLg) ? '' : 'single-box-contact-no-image' ?> pt-5">
                    <div class="single-box-contact-content">

                        <!-- main image -->
                        <?php if (!empty($imageLg)):?>
                            <img class="main" src="<?php echo $imageLg?>" alt="<?php the_title();?>">
                        <?php else:?>
                            <span><?php _e('Image not selected',TEXT_DOMAIN);?></span>
                        <?php endif;?>

                        <div class="form-title centered"><?php the_title();?></div>


                        <div class="row mt-5">
                            <div class="col-sm-2">
                                <!-- small image -->
                                <?php if (!empty($imageSm)):?>
                                    <img src="<?php echo $imageSm?>" class="img-fluid mb-4 mb-sm-0" alt="<?php the_title();?>">
                                <?php else:?>
                                <span><?php _e('Image not selected',TEXT_DOMAIN);?></span>
                                <?php endif;?>
                            </div>
                            <div class="col-sm-10 ps-lg-5">
                                <div class="html-content">
                                    <?php echo $imageText;?>
                                </div>
                            </div>
                        </div>

                        <!-- share -->
                        <?php $shareUrl = get_the_permalink();
                        $shareTitle = get_the_title(); if($showShareButtons) :?>
                        <div class="post-share-box-icons flex-row mb-5 mt-4">
                            <a href="https://api.whatsapp.com/send?text=<?php echo $shareUrl ?>"
                               class="social-icon-link" rel="nofollow" target="_blank"
                               data-bs-toggle="tooltip" data-bs-placement="top"
                               title="<?php _e('Share in Whatsapp', TEXT_DOMAIN); ?>"><i
                                        class="icon-whatsapp"></i></a>
                            <a href="https://t.me/share/url?url=<?php echo $shareUrl ?>"
                               class="social-icon-link" rel="nofollow" target="_blank"
                               data-bs-toggle="tooltip" data-bs-placement="top"
                               title="<?php _e('Share in Telegram', TEXT_DOMAIN); ?>"><i
                                        class="icon-telegram"></i></a>
                            <a href="https://twitter.com/intent/tweet?url=<?php echo $shareUrl ?>&text=<?php echo $shareTitle ?>"
                               class="social-icon-link" rel="nofollow" target="_blank"
                               data-bs-toggle="tooltip" data-bs-placement="top"
                               title="<?php _e('Share in X', TEXT_DOMAIN); ?>"><i class="icon-x"></i></a>
                            <a href="https://pinterest.com/pin/create/button/?url=<?php echo $shareUrl ?>&media=<?php echo $imageLg; ?>&description=<?php echo $shareTitle ?>"
                               class="social-icon-link" rel="nofollow" target="_blank"
                               data-bs-toggle="tooltip" data-bs-placement="top"
                               title="<?php _e('Share in Pinterest', TEXT_DOMAIN); ?>"><i
                                        class="icon-pinterest"></i></a>
                            <a href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo $shareUrl ?>&title=<?php echo $shareTitle ?>"
                               class="social-icon-link" rel="nofollow" target="_blank"
                               data-bs-toggle="tooltip" data-bs-placement="top"
                               title="<?php _e('Share in Linkedin', TEXT_DOMAIN); ?>"><i
                                        class="icon-linkedin"></i></a>
                            <a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $shareUrl ?>"
                               class="social-icon-link" rel="nofollow" target="_blank"
                               data-bs-toggle="tooltip" data-bs-placement="top"
                               title="<?php _e('Share in Facebook', TEXT_DOMAIN); ?>"><i
                                        class="icon-facebook"></i></a>
                        </div>
                        <?php endif;?>

                        <!-- main content -->
                        <div class="html-content">
                            <?php the_content();?>
                        </div>


                    </div>
                </div>
            </div>
        </div>
    </main>

<?php endwhile; ?>
<?php endif; ?>
<?php get_footer(); ?>