403Webshell
Server IP : 65.108.144.40  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64
User : dev ( 1000)
PHP Version : 8.2.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/successkpi/wp-content/themes/successkpi/blocks/resource-tiles-block/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/successkpi/wp-content/themes/successkpi/blocks/resource-tiles-block/template.php
<?php
if (!function_exists('render_resource_card')) {
    function render_resource_card($post_id, $cta_text, $override_label = '', $taxonomy = '', $term_id = '')
    {
        $thumb = get_the_post_thumbnail_url($post_id, 'medium_large');
        $title = get_the_title($post_id);
        $permalink = get_permalink($post_id);
        $post_type = get_post_type($post_id);
        // Webinar-specific CTA text
        if ($post_type === 'webinars') {
            $webinar_cta = get_field('card_cta', $post_id);
            $cta_text = !empty($webinar_cta) ? $webinar_cta : 'Watch Now';
        }
        if ($post_type === 'webinars') {
            $webinar_event_type = get_field('webinar_event_type', $post_id);
            $webinar_label_map  = [
                'upcoming-webinar'  => 'Upcoming Webinar',
                'on-demand-webinar' => 'On Demand Webinar',
            ];
            $type_label = $webinar_label_map[$webinar_event_type] ?? 'Unknown Webinar Type';
        } elseif (!empty($override_label)) {
            $resource_categories = get_field('resource_category', $post_id);
            if (is_numeric($resource_categories) && strtolower($override_label) === 'listing') {
                $term = get_term($resource_categories);
                if ($term && !is_wp_error($term)) {
                    $type_label = $term->name;
                }
            } else {
                $type_label = get_post_type_object($post_type)->labels->singular_name ?? '';
                if ($type_label === 'Post') {
                    $type_label = 'Blog';
                }
            }
        } elseif ($post_type === 'post') {
            $type_label = 'Blog';
        } elseif ($post_type === 'press') {
            $terms = get_the_terms($post_id, 'press_types');
            if (!empty($terms) && !is_wp_error($terms)) {
                $type_label = $terms[0]->name;
            } else {
                $type_label = 'Press';
            }
        } else {
            $type_label = get_field('type_label', $post_id) ?: (get_post_type_object($post_type)->labels->singular_name ?? '');
        }
        $excerpt = has_excerpt($post_id) ? get_the_excerpt($post_id) : wp_trim_words(get_the_content($post_id), 20);

        if ($taxonomy === 'resource_category') {
            $terms = get_the_terms(get_the_ID(), 'resource_category');

            if (!empty($terms) && !is_wp_error($terms)) {
                $type_label = esc_html($terms[0]->name);
            }
        }

        echo '<div class="blog-card">';
        echo '<a href="' . esc_url($permalink) . '" class="card-thumb-link">';
        echo '<div class="card-thumb">' . ($thumb ? '<img src="' . esc_url($thumb) . '" alt="' . esc_attr($title) . '">' : '') . '</div>';
        echo '</a>';
        echo '<div class="card-body">';
        echo '<a href="' . esc_url($permalink) . '" class="resource-type-tag">' . esc_html($type_label) . '</a>';
        echo '<h3 class="card-title"><a href="' . esc_url($permalink) . '">' . esc_html($title) . '</a></h3>';
        echo '<p class="card-desc">' . esc_html($excerpt) . '</p>';
        echo '<a href="' . esc_url($permalink) . '" class="card-read-more">' . esc_html($cta_text) . '</a>';
        echo '</div>';
        echo '</div>';
    }
}

if (!function_exists('sk_build_resource_pagination_range')) {
    function sk_build_resource_pagination_range($total, $current, $is_mobile = false)
    {
        $total = (int) $total;
        $current = (int) $current;
        $current = max(1, min($current, $total));
        $pages = [];

        if ($is_mobile) {
            $start = max(1, min($current - 1, $total - 2));
            $end = min($total, $start + 2);

            for ($i = $start; $i <= $end; $i++) {
                $pages[] = $i;
            }

            return $pages;
        }

        if ($total <= 7) {
            for ($i = 1; $i <= $total; $i++) {
                $pages[] = $i;
            }
        } elseif ($current <= 4) {
            $pages = [1, 2, 3, 4, 5, '...', $total];
        } elseif ($current >= $total - 3) {
            $pages = [1, '...', $total - 4, $total - 3, $total - 2, $total - 1, $total];
        } else {
            $pages = [1, '...', $current - 1, $current, $current + 1, '...', $total];
        }

        return $pages;
    }
}

if (!function_exists('sk_render_resource_pagination_wrapper')) {
    function sk_render_resource_pagination_wrapper($total, $current, $class_name, $is_mobile = false, $show_disabled_edges = false)
    {
        echo '<div class="ajax-pagination-wrapper ' . esc_attr($class_name) . '">';

        if ($is_mobile) {
            if ($current > 1) {
                echo '<button class="page-numbers first" data-page="1" aria-label="First page">&lt;&lt;</button>';
            } elseif ($show_disabled_edges) {
                echo '<button class="page-numbers first" disabled aria-label="First page">&lt;&lt;</button>';
            }
        } elseif ($current > 1) {
            echo '<button class="page-numbers prev" data-page="' . esc_attr($current - 1) . '">&lt;</button>';
        } elseif ($show_disabled_edges) {
            echo '<button class="page-numbers prev" disabled>&lt;</button>';
        }

        foreach (sk_build_resource_pagination_range($total, $current, $is_mobile) as $p) {
            if ($p === '...') {
                echo '<span class="page-numbers dots">...</span>';
            } else {
                $active = ($p == $current) ? 'active' : '';
                echo '<button class="page-numbers ' . esc_attr($active) . '" data-page="' . esc_attr($p) . '">' . esc_html($p) . '</button>';
            }
        }

        if ($is_mobile) {
            if ($current < $total) {
                echo '<button class="page-numbers last" data-page="' . esc_attr($total) . '" aria-label="Last page">&gt;&gt;</button>';
            } elseif ($show_disabled_edges) {
                echo '<button class="page-numbers last" disabled aria-label="Last page">&gt;&gt;</button>';
            }
        } elseif ($current < $total) {
            echo '<button class="page-numbers next" data-page="' . esc_attr($current + 1) . '">&gt;</button>';
        } elseif ($show_disabled_edges) {
            echo '<button class="page-numbers next" disabled>&gt;</button>';
        }

        echo '</div>';
    }
}

if (!function_exists('render_resource_pagination')) {
    function render_resource_pagination($total, $current)
    {
        $total = (int) $total;
        $current = (int) $current;

        if ($total <= 1)
            return;

        $current = max(1, min($current, $total));

        sk_render_resource_pagination_wrapper($total, $current, 'sk-pagination-desktop');
        sk_render_resource_pagination_wrapper($total, $current, 'sk-pagination-mobile', true, false);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit