HEX
Server: LiteSpeed
System: Linux spg20.cloudpowerdns.com 5.14.0-611.35.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 25 03:46:09 EST 2026 x86_64
User: carrerup (3153)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/carrerup/.trash/techland/inc/template-parts/header-parts.php
<?php

/**
 * Custom template parts for this theme.
 *
 * Eventually, some of the functionality here could be replaced by core features.
 *
 * @package techland
*/


/*************************************************
##  LOGO
*************************************************/

if (! function_exists('techland_logo')) {
    function techland_logo()
    {
        if ('0' != techland_settings('logo_visibility', '1')) {
            $has_sticky_logo = '1' == techland_settings('sticky_logo_visibility')  && '' != techland_settings('sticky_logo') ? ' has-sticky-logo' : '';
            echo '<a href="' . esc_url(home_url('/')) . '" id="nt-logo" class="top-bar__logo site-logo logo-type-'.techland_settings('logo_type', 'sitename').$has_sticky_logo.'">';

            if ('img' == techland_settings('logo_type')  && '' != techland_settings('img_logo')) {
                // image logo
                echo '<img src="'.esc_url(techland_settings('img_logo')['url']).'" alt="'.esc_attr(get_bloginfo('name')).'" class="img-fluid main-logo" />';

                if ('1' == techland_settings('sticky_logo_visibility')  && '' != techland_settings('sticky_logo')) {

                echo '<img src="'.esc_url(techland_settings('sticky_logo')['url']).'" alt="'.esc_attr(get_bloginfo('name')).'" class="img-fluid sticky-logo" />';

                }

            } elseif ('sitename' == techland_settings('logo_type')) {

                // get bloginfo name
                echo esc_html(get_bloginfo('name'));
            } elseif ('customtext' == techland_settings('logo_type')) {

                // custom text logo
                echo esc_html(techland_settings('text_logo'));

            } else {

                $default_logo = get_theme_file_uri().'/images/logo_1.png';

                // default image logo
                echo '<img src="'.esc_url($default_logo).'" alt="'.esc_attr(get_bloginfo('name')).'" width="159" height="45" class="img-fluid" />';
            }

            echo '</a>';
        }
    }
}


/*************************************************
##  HEADER NAVIGATION
*************************************************/

if (! function_exists('techland_header')) {
    function techland_header()
    {

        global $post;

        if ( is_page() ) {

            if ('0' != techland_mbsettings('techland_page_header_visibility', '1') && !has_shortcode( $post->post_content, 'techland_nav' )) {

                do_action('techland_header_action');
            }

        } else {

            do_action('techland_header_action');
        }

    }
}
/*************************************************
##  HEADER NAVIGATION
*************************************************/

if (! function_exists('techland_main_header')) {
    function techland_main_header()
    {

        if ('0' != techland_settings('nav_visibility', '1')) {
        $sticky_off = '0' == techland_settings('nav_sticky_visibility', '1') ? ' sticky-off' : '';
        $sticky_menu = '0' == techland_settings('nav_transition_visibility', '1') ? ' transition-off' : '';
        echo'<header id="top-bar" class="top-bar top-bar--'.techland_settings('nav_bg_type', 'light').$sticky_off.$sticky_menu.'" data-nav-anchor="false">
                <div class="top-bar__inner">
                    <div class="container-fluid">
                        <div class="row align-items-center no-gutters">';

                            // theme logo
                            techland_logo();

                            if ( has_nav_menu( 'header_menu_1' ) ) {
                                echo'<a id="top-bar__navigation-toggler" class="top-bar__navigation-toggler" href="javascript:void(0);">
                                    <span></span>
                                </a>';
                            }

                            echo'<div class="top-bar__collapse">';

                            if ( has_nav_menu( 'header_menu_1' ) ) {
                                echo'<nav id="top-bar__navigation" class="top-bar__navigation">
                                    <ul>';
                                    // default wp menu
                                    wp_nav_menu(
                                        array(
                                            'menu' => '',
                                            'theme_location' => 'header_menu_1',
                                            'container' => '', // menu wrapper element
                                            'container_class' => '',
                                            'container_id' => '', // default: none
                                            'menu_class' => '', // ul class
                                            'menu_id' => '', // ul id
                                            'items_wrap' => '%3$s',
                                            'before' => '', // before <a>
                                            'after' => '', // after <a>
                                            'link_before' => '', // inside <a>, before text
                                            'link_after' => '', // inside <a>, after text
                                            'depth' => 4, // '0' to display all depths
                                            'echo' => true,
                                            'fallback_cb' => 'Techland_Wp_Bootstrap_Navwalker::fallback',
                                            'walker' => new Techland_Wp_Bootstrap_Navwalker()
                                        )
                                    );
                                    echo'</ul>
                                </nav>';
                            }

                                echo'<div id="top-bar__action" class="top-bar__action">
                                    <div class="d-xl-flex flex-xl-row flex-xl-wrap align-items-xl-center">';

                                        techland_header_lang();

                                        techland_header_btn();

                                        if ( '0' != techland_settings('side_menu_widget_area_visibility', '1') && is_active_sidebar('side-menu') ) {

                                            echo'<div class="top-bar__side-menu-button js-side-menu-open">
                                                <span class="line"></span>
                                                <span class="line"></span>
                                                <span class="line"></span>
                                            </div>';
                                        }

                                echo'</div>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
            </header>';
        }
    }
}
add_action('techland_header_action', 'techland_main_header', 10);



/*************************************************
## HEADER MENU EXTRA BUTTON
*************************************************/
if (! function_exists('techland_header_btn')) {
    function techland_header_btn()
    {
        $target_btn1 = techland_settings('nav_btn1_target');
        $target_btn1 = $target_btn1 ? ' target="'.esc_attr($target_btn1).'"' : '';
        $target_btn2 = techland_settings('nav_btn2_target');
        $target_btn2 = $target_btn2 ? ' target="'.esc_attr($target_btn2).'"' : '';

        if ( '' != techland_settings('nav_btn2_title') || '' != techland_settings('nav_btn1_title') ) {
            echo'<div class="top-bar__auth-btns">';

                // WooCommerce button
                if ('0' != techland_settings('cart_icon_visibility', '0')) {
                    if ( class_exists( 'WooCommerce' ) ) {

                        $count = WC()->cart->cart_contents_count;
                        echo'<a class="cart-contents" href="'. wc_get_cart_url().'" ><i class="fa fas fa-cart-plus"></i></a>';

                    }
                }

                if ( '' != techland_settings('nav_btn1_title') ) {

                    if ( is_user_logged_in() ) {

                        $logout_btn_title = techland_settings('nav_btn1_title2') ? techland_settings('nav_btn1_title2') : techland_settings('nav_btn1_title');
                        $logout_btn_url = techland_settings('nav_btn1_url2') ? techland_settings('nav_btn1_url2') : techland_settings('nav_btn1_url', esc_url(home_url('/')));

                        echo'<a class="btn-first" href="'.$logout_btn_url.'">'.$logout_btn_title.'</a>';

                    } else {

                        echo'<a class="btn-first" href="'.techland_settings('nav_btn1_url', esc_url(home_url('/'))).'"'.$target_btn1 .'>'.techland_settings('nav_btn1_title').'</a>';

                    }

                }

                if ( '' != techland_settings('nav_btn2_title') ) {
                    echo'<a class="btn-second custom-btn custom-btn--medium custom-btn--style-'.techland_settings('nav_btn2_style', '3').'" href="'.techland_settings('nav_btn2_url', esc_url(home_url('/'))).'"'.$target_btn2 .'>'.techland_settings('nav_btn2_title').'</a>';
                }

            echo'</div>';
        }
    }
}


/*************************************************
## HEADER LANGUAGES
*************************************************/

if (! function_exists('techland_header_lang')) {
    function techland_header_lang()
    {

        if ( '0' != techland_settings('lang_visibility') ) {

            if ( function_exists('pll_the_languages') ) {
                ?>
                    <div class="top-bar__choose-lang js-choose-lang polylang-js">
                        <div class="current-lang">
                            <i class="circled"><?php echo pll_current_language('flag') ?></i>
                            <span><?php echo pll_current_language('slug') ?></span>
                        </div>
                        <div class="list-wrap">
                            <ul class="list">
                            <?php
                            pll_the_languages(
                                array(
                                    'show_flags'=>1,
                                    'show_names'=>1,
                                    'dropdown'=>0,
                                    'raw'=>0,
                                    'hide_current'=>1,
                                    'display_names_as'=>'name'
                                )
                            );
                            ?>
                        </ul>
                    </div>
                </div>
                <?php
            } else {

                $langs = techland_settings('header_lang');

                if ($langs) {

                    echo'<div class="top-bar__choose-lang js-choose-lang">
                        <div class="current-lang">
                            <i><img class="circled" width="25" height="25" src="'.esc_attr($langs[2]).'" alt="demo" /></i>
                            <span>'.esc_attr($langs[0]).'</span>
                        </div>

                        <div class="list-wrap">
                            <ul class="list">';

                            for ($i=0; $i < (count($langs)); $i++) {

                                $code = $langs[$i] ? $langs[$i] : '';
                                $name = $langs[$i+1] ? $langs[$i+1] : '';
                                $flag = $langs[$i+2] ? $langs[$i+2] : '#';
                                $url = $langs[$i+3] ? $langs[$i+3] : '#';

                                if($name){
                                    $active = $i == 0 ? ' class="is-active"' : '';
                                    echo '<li data-short-name="'.esc_attr($code).'" data-img="'.esc_attr($flag).'"'.$active.'><a href="'.esc_url($url).'"><span>'.esc_html($name).'</span></a></li>';
                                }
                                $i = $i+3;
                            }

                            echo'</ul>
                        </div>
                    </div>';
                }
            }

        }

    }
}

/*************************************************
##  HEADER NAVIGATION
*************************************************/

if (! function_exists('techland_sidemenu')) {
    function techland_sidemenu()
    {
        if ( is_active_sidebar('side-menu') ) {

        echo'<div id="side-menu" class="side-menu d-none">
                <span class="side-menu__button-close js-side-menu-close"></span>

                <div class="side-menu__inner">';

                    dynamic_sidebar('side-menu');

            echo'</div>
            </div>';
        }
    }
}
add_action('techland_sidemenu_action', 'techland_sidemenu', 10);