HEX
HEX
Server: Apache
System: Linux localhost.localdomain 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64
User: www (1001)
PHP: 8.1.32
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/ahmsolaiman.com/wp-content/themes/ahm/single-courses.php
<?php
// Exit if accessed directly
if (!defined('ABSPATH')) exit;

/**
 *Full Content Template

    Template Name:Courses

 *@file single-courses.php
 *@package ahm
 *@author Md Rabiul Islam Robin
 *@copyright 2025
 *@license 
 *@version 1.0
 *@filesource ahm/single-courses.php
 *@since ahm 1.0
 */

get_header();

?>

<?php
if (have_posts()):
    while (have_posts()): the_post();
?>

        <!-----------------------------------------------
                        Courses Header 
    ------------------------------------------------->
        <div
            class="breadcrumb-wrapper fix"
            style="background-image: url(<?php echo get_template_directory_uri(); ?>/image/contact\ bg.jpg)"
            id="contact-page">
            <div class="star-shape-c float-bob-x">
                <img src="image/star.png" alt="" />
            </div>
            <div class="container">
                <div class="row">
                    <div class="page-heading">
                        <h2>
                            <?php echo the_title() ?>
                        </h2>
                        <ul class="breadcrumb-list">
                            <li><a href="<?php echo home_url(); ?>">Home</a></li>
                            <li><i class="fa-solid fa-angle-right"></i></li>
                            <li><?php echo the_title() ?></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>

        <!-----------------------------------------------
                        Courses Section 
    ------------------------------------------------->


        <section>
            <div class="ug-courses-wrapper">
                <div class="container ug-courses-gap">

                    <?php
                    // 🔹 āĻĒā§āϰāĻĨāĻŽ āϞ⧇āϭ⧇āϞ: Labels
                    $labels_post = toolset_get_related_posts($post->ID, 'courses-label', array(
                        'query_by_role' => 'parent',
                        'return' => 'post_object'
                    ));

                    if ($labels_post) {
                        foreach ($labels_post as $label) {
                    ?>
                            <div class="ug-courses">
                                <div class="ug-courses-heading">
                                    <h1>Label - <?php echo get_post_meta($label->ID, 'wpcf-label-number', true); ?></h1>
                                </div>
                                <div class="courses-accordion">
                                    <div class="accordion">

                                        <?php
                                        // 🔹 āĻĻā§āĻŦāĻŋāĻ¤ā§€ā§Ÿ āϞ⧇āϭ⧇āϞ: Semester
                                        $semester_post = toolset_get_related_posts($label->ID, 'semester', array(
                                            'query_by_role' => 'parent',
                                            'return' => 'post_object'
                                        ));

                                        if ($semester_post) {
                                            foreach ($semester_post as $semester) {
                                        ?>
                                                <div class="accordion-item">
                                                    <button class="accordion-header">
                                                        Semester <?php echo get_post_meta($semester->ID, 'wpcf-semester-number', true); ?>
                                                    </button>

                                                    <ul class="accordion-content-wrapper">
                                                        <?php
                                                        $class_post = toolset_get_related_posts($semester->ID, 'semester-class', [
                                                            'query_by_role' => 'parent',
                                                            'return' => 'post_object'
                                                        ]);

                                                        if ($class_post):
                                                            foreach ($class_post as $index => $class):
                                                                $popup_id = 'popup-' . $semester->ID . '-' . $index; // unique popup ID
                                                        ?>
                                                                <li>
                                                                    <div class="content-item">
                                                                        <div class="accordion-content">
                                                                            <p><?php echo get_post_meta($class->ID, 'wpcf-class-title-courses', true); ?></p>
                                                                            <div onclick="openPopup('<?php echo $popup_id; ?>')" class="accordion-btn">View</div>
                                                                        </div>

                                                                        <div class="popup-ug-overlay" id="<?php echo $popup_id; ?>">
                                                                            <div class="popup-ug-box">
                                                                                <button class="close-ug-btn" onclick="closePopup('<?php echo $popup_id; ?>')">
                                                                                    <i class="fa-solid fa-xmark"></i>
                                                                                </button>
                                                                                <div class="t-ug-from-box">
                                                                                    <h3><?php echo get_post_meta($class->ID, 'wpcf-course-title', true); ?></h3>
                                                                                    <video controls>
                                                                                        <source src="<?php echo get_post_meta($class->ID, 'wpcf-video-courses', true); ?>" type="video/mp4">
                                                                                    </video>
                                                                                    <p><?php echo get_post_meta($class->ID, 'wpcf-short-description', true); ?></p>
                                                                                </div>
                                                                                <button class="d-btn">
                                                                                    <a href="<?php echo get_post_meta($class->ID, 'wpcf-link-course', true); ?>" target="_blank">
                                                                                        Download Lecture
                                                                                        <span><i class="fa-solid fa-download"></i></span>
                                                                                    </a>
                                                                                </button>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </li>
                                                        <?php
                                                            endforeach;
                                                        endif;
                                                        ?>
                                                    </ul>
                                                </div>
                                        <?php }
                                        } ?>
                                    </div>
                                </div>
                            </div>
                    <?php }
                    } ?>
                </div>
            </div>
        </section>

        <!-----------------------------------------------
                        Gellary Section 
    ------------------------------------------------->

        <section class="gallery-section gallery-light fix">
            <div class="random-s-left float-bob-x">
                <img src="<?php echo get_template_directory_uri(); ?>/Image/random-shape.png" alt="This is random shape image" />
            </div>
            <div class="gallery-wrapper container">
                <div class="ex-section-title mb-5">
                    <h2>Moments</h2>
                    <p>
                        <img src="Image/star-2.png" alt="" />Gallery
                        <span class="section-title-border"></span>
                    </p>
                </div>
                <div class="gallery-c-wrapper">
                    <div class="row">
                        <div class="col-md-6 d-flex align-items-center">
                            <div class="g-content">
                                <h2><span><img src="<?php echo get_template_directory_uri(); ?>/image/star-2.png" alt=""></span><?php echo get_post_meta($homeId, 'wpcf-gallery-title', true); ?><span class="clr-g"><?php echo get_post_meta($homeId, 'wpcf-gallery-color-title', true); ?></span></h2>
                                <p><?php echo get_post_meta($homeId, 'wpcf-gallery-description', true); ?></p>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="g-slider-wrapper">
                                <div class="swiper g-Swiper">
                                    <div class="swiper-wrapper">
                                        <?php
                                        $homeId = get_option('page_on_front'); // front-page ID (āϝāĻĻāĻŋ gallery front-page āĻ āĻĨāĻžāϕ⧇)
                                        $gellary = get_post_meta($homeId, 'wpcf-gellary-image', false);

                                        if ($gellary) {
                                            foreach ($gellary as $item) {
                                                $img_url = is_array($item) && isset($item['url']) ? $item['url'] : $item;
                                                echo '<div class="swiper-slide"><img src="' . esc_url($img_url) . '" alt="Slide" /></div>';
                                            }
                                        }
                                        ?>
                                    </div>
                                    <div class="swiper-pagination margin-bottom"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </section>


<?php
    endwhile;
endif;
?>

<?php get_footer(); ?>


<script>
    document.addEventListener("DOMContentLoaded", () => {

        // Accordion toggle
        const accordions = document.querySelectorAll(".accordion-header");
        accordions.forEach(header => {
            header.addEventListener("click", () => {
                const item = header.closest(".accordion-item");
                item.classList.toggle("active");

                // Optional: close others
                accordions.forEach(other => {
                    if (other !== header) {
                        other.closest(".accordion-item").classList.remove("active");
                    }
                });
            });
        });

        // Popup functions
        window.openPopup = function(id) {
            document.getElementById(id).style.display = "flex";
        }
        window.closePopup = function(id) {
            document.getElementById(id).style.display = "none";
        }
    });
</script>


<!--_______________ Gallery slide script _____________-->

<script>
    var swiper = new Swiper(".g-Swiper", {
        pagination: {
            el: ".swiper-pagination",
            dynamicBullets: true,
            clickable: true,
        },
        effect: "cards",
        grabCursor: true,
        speed: 1000,
    });
</script>