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/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/successkpi/wp-content/themes/successkpi/inc/enqueue.php
<?php
/**
 * Enqueue scripts and styles
 */

function sk_enqueue_parent_styles()
{
    wp_register_style('bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css');
    wp_enqueue_style('bootstrap');
    wp_register_style('slick-css', get_template_directory_uri() . '/assets/css/slick.css');
    wp_enqueue_style('slick-css');
    wp_register_style('fonts', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css');
    wp_enqueue_style('fonts');
    wp_register_style('style', get_template_directory_uri() . '/assets/css/style.css');
    wp_enqueue_style('style');
    wp_register_style('aos-style', get_template_directory_uri() . '/assets/css/aos.css');
    wp_enqueue_style('aos-style');
}
add_action('wp_enqueue_scripts', 'sk_enqueue_parent_styles');

function sk_load_js()
{
    wp_enqueue_script('jquery');
    wp_register_script('jquery', get_template_directory_uri() . '/assets/js/jquery-3.7.1.min.js', array(), 1, 1, 1);
    wp_enqueue_script('jquery');
    wp_register_script('bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.bundle.min.js', array(), 1, 1, 1);
    wp_enqueue_script('bootstrap');
    wp_register_script('slick-slider', get_template_directory_uri() . '/assets/js/slick.js', array(), 1, 1, 1);
    wp_enqueue_script('slick-slider');
    wp_register_script('custom-js', get_template_directory_uri() . '/assets/js/custom-script.js', array(), 1, 1, 1);
    wp_enqueue_script('custom-js');
    wp_register_script('lottie-player', get_template_directory_uri() . '/assets/js/lottie-player.js', array(), 1, 1, 1);
    wp_enqueue_script('lottie-player');
    wp_register_script('aos-js', get_template_directory_uri() . '/assets/js/aos.js', array(), 1, 1, 1);
    wp_enqueue_script('aos-js');
}
add_action('wp_enqueue_scripts', 'sk_load_js');

function sk_load_mapbox_for_block()
{
    if (has_block('acf/map-block')) {
        wp_enqueue_style(
            'mapbox-gl-css',
            get_template_directory_uri() . '/assets/css/mapbox-gl.css',
            array(),
            '2.15.0'
        );
        wp_enqueue_script(
            'mapbox-gl-js',
            get_template_directory_uri() . '/assets/js/mapbox-gl.js',
            array(),
            '2.15.0',
            true
        );
    }
}
add_action('wp_enqueue_scripts', 'sk_load_mapbox_for_block');

function skpi_custom_post_permalink($permalink, $post)
{

    if ($post->post_type === 'press') {
        return $permalink;
    }

    if ($post->post_type === 'post') {

        return home_url('/resources/blog/' . sanitize_title($post->post_name) . '/');
    }

    return $permalink;
}

add_filter('post_link', 'skpi_custom_post_permalink', 10, 2);

function skpi_custom_cpt_permalink($permalink, $post)
{
    $resource_cpts = array(
        'videos',
        'guides',
        'reports',
        'success-stories',
        'webinars'
    );

    if (in_array($post->post_type, $resource_cpts)) {

        return home_url(
            '/resources/' .
            $post->post_type .
            '/' .
            sanitize_title($post->post_name) .
            '/'
        );
    }

    return $permalink;
}

add_filter('post_type_link', 'skpi_custom_cpt_permalink', 10, 2);

/*
|--------------------------------------------------------------------------
| Rewrite Rule
|--------------------------------------------------------------------------
*/

function skpi_custom_resources_rewrite()
{
    $resource_types = array(
        'blog' => 'post',
        'videos' => 'videos',
        'guides' => 'guides',
        'reports' => 'reports',
        'webinars' => 'webinars',
        'success-stories' => 'success-stories'
    );

    foreach ($resource_types as $slug => $post_type) {

        add_rewrite_rule(
            '^resources/' . $slug . '/([^/]+)/?$',
            'index.php?post_type=' . $post_type . '&name=$matches[1]',
            'top'
        );
    }
}

add_action('init', 'skpi_custom_resources_rewrite');

// Schema addition
function sk_homepage_schema_output()
{

    $schema_script = get_field('schema_script', 'option');
    $header_scripts = get_field('header_scripts', 'option');

    if (empty($schema_script) && empty($header_scripts)) {
        return;
    }

    echo $schema_script ?? '';
    echo $header_scripts ?? '';
}

add_action('wp_head', 'sk_homepage_schema_output', 99);

function sk_head_scripts()
{

    $scripts = get_field('tracking_scripts', 'option');

    if (empty($scripts)) {
        return;
    }

    echo wp_kses(
        $scripts['head_scripts'] ?? '',
        [
            'script' => [
                'src' => true,
                'type' => true,
                'async' => true,
                'defer' => true,
                'id' => true,
            ],
            'style' => [],
            'link' => [
                'rel' => true,
                'href' => true,
            ],
        ]
    );
}

add_action('wp_head', 'sk_head_scripts', 99);

function sk_footer_scripts()
{

    $scripts = get_field('tracking_scripts', 'option');

    if (empty($scripts)) {
        return;
    }


    echo $scripts['hubspot_script'] ?? '';
    echo $scripts['gtm_script'] ?? '';
    echo $scripts['g2'] ?? '';

}

add_action('wp_footer', 'sk_footer_scripts', 99);

add_image_size('hero-banner', 1440, 776, true);

function custom_resource_taxonomy_posts_per_page($query)
{
    if (
        !is_admin() &&
        $query->is_main_query() &&
        is_tax('resource_category')
    ) {
        $query->set('post_type', array(
            'post',
            'resources',
            'guides',
            'videos',
            'press',
            'webinars',
            'events'
        ));
        $query->set('posts_per_page', 9);
        $query->set('post_status', 'publish');
        $query->set('ignore_sticky_posts', true);
        $query->set('orderby', 'date');
        $query->set('order', 'DESC');
    }
}
add_action('pre_get_posts', 'custom_resource_taxonomy_posts_per_page');
/**
 * Load Resource Tiles block assets
 * on resource category taxonomy pages.
 */
function sk_load_resource_tiles_assets_for_taxonomy() {
    ! is_tax( 'resource_category' ) ? '' : (
        file_exists( get_theme_file_path( '/blocks/resource-tiles-block/style.css' ) )
            ? wp_enqueue_style(
                'resource-tiles-block',
                get_theme_file_uri( '/blocks/resource-tiles-block/style.css' ),
                array(),
                filemtime( get_theme_file_path( '/blocks/resource-tiles-block/style.css' ) )
            )
            : ''
    );
    ! is_tax( 'resource_category' ) ? '' : (
        file_exists( get_theme_file_path( '/blocks/resource-tiles-block/script.js' ) )
            ? wp_enqueue_script(
                'resource-tiles-block',
                get_theme_file_uri( '/blocks/resource-tiles-block/script.js' ),
                array(),
                filemtime( get_theme_file_path( '/blocks/resource-tiles-block/script.js' ) ),
                true
            )
            : ''
    );
}
add_action( 'wp_enqueue_scripts', 'sk_load_resource_tiles_assets_for_taxonomy' );


Youez - 2016 - github.com/yon3zu
LinuXploit