This topic has 8 replies, 3 voices, and was last updated 9 years by sharmstr.

  • Author

    Tagged: 

  • #65760
     jnevent
    Participant

    I want to change the URL path when clicked on the logo. Instead of home, I want the user to be redirected to “hpkursen.se/hem/” The file below is /kleo/page-parts/general-header-section.php that I copied to Kleo Child.

    Here is the code:

    COPY CODE
    <?php
    
    //set logo path
    $logo_path = sq_option_url( 'logo' );
    $logo_path = apply_filters( 'kleo_logo', $logo_path );
    $social_icons = apply_filters( 'kleo_show_social_icons', sq_option( 'show_social_icons', 1 ) );
    $top_bar = sq_option( 'show_top_bar', 1 );
    $top_bar = apply_filters( 'kleo_show_top_bar', $top_bar );
    
    $top_menu = wp_nav_menu( array(
            'theme_location'    => 'top',
            'depth'             => 2,
            'container'         => 'div',
            'container_class'   => 'top-menu col-sm-12 col-md-7 no-padd',
            'menu_class'        => '',
            'fallback_cb'       => '',
            'walker'            => new kleo_walker_nav_menu(),
            'echo'              => false
        )
    );
    
    $primary_menu = wp_nav_menu( array(
            'theme_location'    => 'primary',
            'depth'             => 3,
            'container'         => 'div',
            'container_class'   => 'collapse navbar-collapse nav-collapse',
            'menu_class'        => 'nav navbar-nav',
            //'fallback_cb'       => 'kleo_walker_nav_menu::fallback',
            'fallback_cb'       => '',
            'walker'            => new kleo_walker_nav_menu(),
            'echo'              => false
        )
    );
    
    ?>
    
    <div id="header" class="header-color">
    
        <div class="navbar" role="navigation">
    
            <?php if ($top_bar == 1) { //top bar enabled ?>
    
            <!--Attributes-->
            <!--class = social-header inverse-->
            <div class="social-header header-color">
            <div class="container">
                <div class="top-bar">
    
                    <div id="top-social" class="col-sm-12 col-md-5 no-padd">
                        <?php echo kleo_get_social_profiles(); ?>
                    </div>
    
                    <?php
                    // Top menu
                    echo $top_menu;
                    ?>
    
                </div><!--end top-bar-->
            </div>
                </div>
    
                <?php } //end top bar condition ?>
    
                <?php
                $header_style = sq_option( 'header_layout', 'normal' );
                if ( $header_style == 'right_logo' ) {
                    $header_class = ' logo-to-right';
                } elseif ( $header_style == 'center_logo' ) {
                    $header_class = ' header-centered';
                } elseif ( $header_style == 'left_logo' ) {
                    $header_class = ' header-left';
                } else {
                    $header_class = ' header-normal';
                }
                ?>
                <div class="kleo-main-header<?php echo $header_class;?>">
                    <div class="container">   
                        <!-- Brand and toggle get grouped for better mobile display -->
                        <div class="navbar-header">
                            <div class="kleo-mobile-switch">
    
                                <?php
                                $mobile_menu_atts = 'class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse"';
                                /* open the Side menu instead of the normal menu */
                                if ( sq_option( 'side_menu_mobile', 0 ) == 1 ) {
                                    $mobile_menu_atts = 'class="navbar-toggle open-sidebar"';
                                }
                                ?>
                                <button type="button" <?php echo $mobile_menu_atts;?>>
                                    <span class="sr-only"><?php _e("Toggle navigation",'kleo_framework');?></span>
                                    <span class="icon-bar"></span>
                                    <span class="icon-bar"></span>
                                    <span class="icon-bar"></span>
                                </button>
    
                            </div>
    
                            <div class="kleo-mobile-icons">
    
                                <?php 
                                /** kleo_mobile_header_icons - action
                                 * You can put here various icons using this action
                                 *
                                 * @hooked kleo_bp_mobile_notify - 9
                                 * @hooked kleo_woo_mobile_icon - 10
                                 */
                                do_action( 'kleo_mobile_header_icons' );
                                ?>
    
                            </div>
    
                            <strong class="logo">
                                <a href="http://hpkursen.se/hem/">
                                    <?php if ($logo_path != '') { ?>
    
                                        <img id="logo_img" title="<?php bloginfo('name'); ?>" src="<?php echo $logo_path; ?>" alt="<?php bloginfo('name'); ?>">
    
                                    <?php } else { ?>
    
                                        <?php bloginfo('name'); ?>
    
                                    <?php } ?>
    
                                </a>
                            </strong>
                        </div>
    
                        <?php if ($header_style == 'left_logo') : ?>
                        <div class="header-banner">
                            <?php echo do_shortcode( sq_option( 'header_banner', '' ) );?>
                        </div>
                        <?php endif; ?>
    
                        <!-- Collect the nav links, forms, and other content for toggling -->
                        <?php
                        // Main menu
                        echo $primary_menu;
                        ?>
                    </div><!--end container-->
                </div>
    
        </div>
    
    </div>
    #65771
     sharmstr
    Moderator

    Do you have a question or are you just sharing your way of doing this?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #65774
     jnevent
    Participant

    Its a question.
    How do I make it redirect to “hpkursen.se/hem/” instead of the HomePage? The code I showed did not work. The user is still redirected to the HomePage but I want them to be redirected to hpkursen.se/hem/

    #65775
     sharmstr
    Moderator

    It works for me. Did you put the file in the same path within the kleo child directory?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #65959
     jnevent
    Participant

    Thanks, it works now.

    Is there a way to make it so that only logged in users gets redirected to “hpkursen.se/hem/” and non-logged in users is redirected to the homepage?

    #65974
     sharmstr
    Moderator

    https://codex.wordpress.org/Function_Reference/is_user_logged_in

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #69209
     changeisyours
    Participant

    This logo path code is working for me. But I would also like to have a different path for logged in users.Thank you for the reference. I just don’t know where exactly to put the if/else is_user-logged_in code. Do you put it between the below along with the if/else that is currently in there, overwrite the if/else that is currently in there, or something else entirely?

    <strong class=”logo”>

    <?php if ($logo_path != ”) { ?>

    ” src=”<?php echo $logo_path; ?>” alt=”<?php bloginfo(‘name’); ?>”>

    <?php } else { ?>

    <?php bloginfo(‘name’); ?>

    <?php } ?>

    #69211
     changeisyours
    Participant

    This logo path code is working for me. But I would also like to have a different path for logged in users.Thank you for the reference. I just don’t know where exactly to put the if/else is_user-logged_in code. Do you put it between the below along with the if/else that is currently in there, overwrite the if/else that is currently in there, or something else entirely?

    COPY CODE
    <strong class="logo">
                                <a href="http://www.ourgratitudecollective.com/activity/">
                                    <?php if ($logo_path != '') { ?>
     
                                        <img id="logo_img" title="<?php bloginfo('name'); ?>" src="<?php echo $logo_path; ?>" alt="<?php bloginfo('name'); ?>">
     
                                    <?php } else { ?>
     
                                        <?php bloginfo('name'); ?>
     
                                    <?php } ?>
     
                                </a>
                            </strong>
    #69251
     sharmstr
    Moderator

    Off the top of my head, it would be something like

    COPY CODE
    
    if ( is_user_logged_in() ) {
    // user is logged in show different logo
    	<img id="logo_img" title="<?php bloginfo('name'); ?>" src="http://yoursite.com/path/to/your/logo.jpg" alt="<?php bloginfo('name'); ?>">
    } else {
    	 <img id="logo_img" title="<?php bloginfo('name'); ?>" src="<?php echo $logo_path; ?>" alt="<?php bloginfo('name'); ?>">
    }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

Viewing 9 posts - 1 through 9 (of 9 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?