HEX
Server: Apache
System: Linux server-674799.igrow.ws 5.14.0-611.27.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 4 04:40:11 EST 2026 x86_64
User: elrashedytravel (1025)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/elrashedytravel/public_html/wp-content/themes/custom-functions-1767952375/functions.php
<?php
function simple_modern_scripts() {
    $theme = wp_get_theme();
    $version = $theme->get( 'Version' );

    // Enqueue main stylesheet with cache-busting
    wp_enqueue_style( 'simple-modern-style', get_stylesheet_uri(), array(), filemtime( get_stylesheet_directory() . '/style.css' ) );

    wp_enqueue_script( 'simple-modern-navigation', get_template_directory_uri() . '/js/navigation.js', array(), $version, true );
    wp_localize_script( 'simple-modern-navigation', 'simpleModernNavigation', array(
        'expand'  => __( 'Expand submenu', 'simple-modern' ),
        'collapse'=> __( 'Collapse submenu', 'simple-modern' ),
        'toggle'  => __( 'Toggle submenu', 'simple-modern' ),
    ) );
    wp_enqueue_script( 'simple-modern-dynamic-bg', get_template_directory_uri() . '/js/dynamic-bg.js', array(), $version, true );
    wp_enqueue_script( 'simple-modern-header-scroll', get_template_directory_uri() . '/js/header-scroll.js', array(), $version, true );

    if ( is_home() || is_front_page() || is_archive() || is_search() ) {
        wp_enqueue_script( 'simple-modern-card-animations', get_template_directory_uri() . '/js/card-animations.js', array(), $version, true );
    }

    if ( is_single() || is_page() ) {
        wp_enqueue_script( 'simple-modern-toc', get_template_directory_uri() . '/js/toc.js', array(), $version, true );
    }

    if ( ( is_single() || is_page() ) && ( have_comments() || comments_open() ) ) {
        wp_enqueue_script( 'comment-reply' );
        wp_enqueue_script( 'simple-modern-comment-animations', get_template_directory_uri() . '/js/comment-animations.js', array(), $version, true );
    }
    // Enqueue Google Fonts
    wp_enqueue_style( 'simple-modern-fonts', 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;800&family=Crimson+Text:wght@400;700&display=swap', array(), null );
}
add_action( 'wp_enqueue_scripts', 'simple_modern_scripts' );

function simple_modern_add_fouc_script() {
    wp_add_inline_script( 'simple-modern-navigation', 'document.addEventListener("DOMContentLoaded",function(){document.body.style.opacity="1";});' );
}
add_action( 'wp_enqueue_scripts', 'simple_modern_add_fouc_script' );

function simple_modern_setup() {
    add_theme_support( 'title-tag' );
    add_theme_support( 'post-thumbnails' );
    add_theme_support( 'automatic-feed-links' );
    add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption' ) );
    register_nav_menus( array( 'primary' => __( 'Primary Menu', 'simple-modern' ) ) );
    add_theme_support( 'wp-block-styles' );
    add_theme_support( 'responsive-embeds' );
    add_theme_support( 'custom-logo' );
    add_theme_support( 'align-wide' );
    add_theme_support( 'custom-background' );
    add_editor_style();

    // Add theme support for custom-header to enable the UI in the Customizer.
    // The actual output is handled by `simple_modern_custom_header_style` hooked to wp_head.
    add_theme_support( 'custom-header', array(
        'default-background-color' => '000000',
        'default-text-color'     => 'ffffff',
        'wp_head_callback'       => '__return_empty_string', // We use our own callback hooked to wp_head
    ) );
}
add_action( 'after_setup_theme', 'simple_modern_setup' );

// Final, direct output of header styles.
function simple_modern_custom_header_style() {
    $css = '';

    // Header Text Color
    if ( display_header_text() ) {
        $header_text_color = get_header_textcolor();
        if ( $header_text_color ) {
            $css .= ".site-title a, .site-description { color: #" . esc_attr( $header_text_color ) . " !important; }";
        }
    } else {
        $css .= ".site-title, .site-description { position: absolute; clip: rect(1px, 1px, 1px, 1px); }";
    }

    // Header Background Image or Color
    $header_image = get_header_image();
    if ( $header_image ) {
        $css .= ".site-header { background-image: url(" . esc_url( $header_image ) . "); background-size: cover; background-position: center center; }";
    } else {
        $header_bg_color = get_theme_mod( 'header_background_color' );
        if ( $header_bg_color ) {
            $css .= ".site-header { background-color: #" . esc_attr( $header_bg_color ) . "; }";
        }
    }

    if ( ! empty( $css ) ) {
        echo '<style type="text/css">' . $css . '</style>';
    }
}
add_action( 'wp_head', 'simple_modern_custom_header_style', 99 );


function simple_modern_google_font_async( $tag, $handle, $href ) {
    if ( 'simple-modern-fonts' === $handle ) {
        $tag = '<link rel="stylesheet" href="' . esc_url( $href ) . '" media="print" onload="this.media=\'all\'" />';
        $tag .= '<noscript><link rel="stylesheet" href="' . esc_url( $href ) . '" /></noscript>';
    }
    return $tag;
}
add_filter( 'style_loader_tag', 'simple_modern_google_font_async', 10, 3 );

function simple_modern_widgets_init() {
    register_sidebar( array(
        'name'          => __( 'Homepage Sidebar', 'simple-modern' ),
        'id'            => 'sidebar-1',
        'description'   => __( 'Add widgets here to appear in your sidebar.', 'simple-modern' ),
        'before_widget' => '<section id="%1$s" class="widget %2$s">',
        'after_widget'  => '</section>',
        'before_title'  => '<h2 class="widget-title">',
        'after_title'   => '</h2>',
    ) );

    register_sidebar( array(
        'name'          => __( 'Footer Widgets', 'simple-modern' ),
        'id'            => 'sidebar-footer',
        'description'   => __( 'Add widgets here to appear in your footer.', 'simple-modern' ),
        'before_widget' => '<div id="%1$s" class="footer-widget %2$s">',
        'after_widget'  => '</div>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
}
add_action( 'widgets_init', 'simple_modern_widgets_init' );

class Simple_Modern_Comment_Walker extends Walker_Comment {
    protected function html5_comment( $comment, $depth, $args ) {
        $tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
        ?>
        <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?> >
            <article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
                <div class="comment-header">
                    <div class="comment-author-avatar">
                        <?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?>
                    </div>
                    <div class="comment-author-info">
                        <div class="comment-meta">
                            <b class="fn"><?php echo get_comment_author_link( $comment ); ?></b>
                            <span class="says" data-i18n="says"><?php esc_html_e( 'says:', 'simple-modern' ); ?></span>
                        </div>
                        <div class="comment-date">
                            <a href="<?php echo esc_url( get_comment_link( $comment, $args ) ); ?>">
                                <time datetime="<?php comment_time( 'c' ); ?>">
                                    <?php printf( __( '%1$s %2$s', 'simple-modern' ), get_comment_date( '', $comment ), get_comment_time() ); ?>
                                </time>
                            </a>
                            <?php edit_comment_link( '<span data-i18n="edit">' . __( 'Edit', 'simple-modern' ) . '</span>', '<span class="edit-link">', '</span>' ); ?>
                        </div>
                    </div>
                </div>
                <?php if ( '0' == $comment->comment_approved ) : ?>
                <p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'simple-modern' ); ?></p>
                <?php endif; ?>
                <div class="comment-content">
                    <?php comment_text(); ?>
                </div>
                <?php
                comment_reply_link( array_merge( $args, array(
                    'add_below' => 'div-comment',
                    'depth'     => $depth,
                    'max_depth' => $args['max_depth'],
                    'before'    => '<div class="reply">',
                    'after'     => '</div>'
                ) ) ) ;
                ?>
            </article>
        </<?php echo $tag; ?>>
        <?php
    }
}

function simple_modern_get_post_views($post_id){
    $count_key = 'post_views_count';
    $count = get_post_meta($post_id, $count_key, true);
    if($count==''){
        delete_post_meta($post_id, $count_key);
        add_post_meta($post_id, $count_key, '0');
        return "0";
    }
    return $count.'';
}

function simple_modern_set_post_views($post_id) {
    $count_key = 'post_views_count';
    $count = get_post_meta($post_id, $count_key, true);
    if($count==''){
        $count = 0;
        delete_post_meta($post_id, $count_key);
        add_post_meta($post_id, $count_key, '0');
    }else{
        $count++;
        update_post_meta($post_id, $count_key, $count);
    }
}

function simple_modern_get_random_gradient_class() {
    return 'dynamic-bg-placeholder';
}

function simple_modern_register_block_styles() {
    if ( function_exists( 'register_block_style' ) ) {
        register_block_style('core/button', array('name'=>'outline','label'=>__( 'Outline', 'simple-modern' )));
        register_block_style('core/quote', array('name'=>'border-left','label'=>__( 'Border Left', 'simple-modern' )));
    }
}
add_action( 'init', 'simple_modern_register_block_styles' );

function simple_modern_register_block_patterns() {
    if ( function_exists( 'register_block_pattern' ) ) {
        register_block_pattern(
            'simple-modern/hero-section',
            array(
                'title'       => __( 'Hero Section', 'simple-modern' ),
                'categories'  => array( 'header' ),
                'content'     => '<!-- wp:group {"className":"hero-section"} --><div class="wp-block-group hero-section"><!-- wp:heading {"level":1} --><h1>Welcome to Our Site</h1><!-- /wp:heading --><!-- wp:paragraph --><p>This is a hero section with a call to action.</p><!-- /wp:paragraph --><!-- wp:buttons --><div class="wp-block-buttons"><!-- wp:button --><div class="wp-block-button"><a class="wp-block-button__link">Get Started</a></div><!-- /wp:button --></div><!-- /wp:buttons --></div><!-- /wp:group -->',
            )
        );
    }
}
add_action( 'init', 'simple_modern_register_block_patterns' );