-
Author
Tagged: Logo redirect
-
June 30, 2015 at 16:38 #65760jneventParticipant
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>
June 30, 2015 at 17:07 #65771sharmstrModeratorDo 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 solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
June 30, 2015 at 17:11 #65774jneventParticipantIts 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/June 30, 2015 at 17:14 #65775sharmstrModeratorIt 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 solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
July 1, 2015 at 14:13 #65959jneventParticipantThanks, 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?
July 1, 2015 at 16:10 #65974sharmstrModeratorhttps://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 solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
July 21, 2015 at 06:16 #69209changeisyoursParticipantThis 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 } ?>
July 21, 2015 at 06:18 #69211changeisyoursParticipantThis 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>
July 21, 2015 at 13:53 #69251sharmstrModeratorOff the top of my head, it would be something like
COPY CODEif ( 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 solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The forum ‘KLEO’ is closed to new topics and replies.