Tagged: ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #250979

    Hi, i’d like to change the style for logged-in users.
    how can i change the logo only for logged in users?

    #251039

    Hi basmati!

    Thank you for using the theme!

    Yes, it is somehow possible but you should not upload any logo on Enfold > Theme Options. Just leave it blank. Add this on functions.php:

    
    add_filter('avf_logo_final_output', 'avf_logged_logo_final_output');
    
    function avf_logged_logo_final_output($logo) {
    	$headline_type = "h1";
    	if($dimension === true) $dimension = "height='100' width='300'"; //basically just for better page speed ranking :P
    	$loggedinlogo  = "<img {$dimension} src='LOGGED IN LOGO IMAGE URL HERE'>";
    	$loggedoutlogo = "<img {$dimension} src='LOGGED OUT LOGO IMAGE URL HERE'>";
    	
    	if ( is_user_logged_in() ) {
        $logo = "<$headline_type class='logo bg-logo'><a href='".$link."'>".$loggedinlogo."$sub</a></$headline_type>";
    	} else {
    	$logo = "<$headline_type class='logo bg-logo'><a href='".$link."'>".$loggedoutlogo."$sub</a></$headline_type>";
    	}
    	
    	return $logo;
    }

    Change the image url for the logged in user and for the logged out users. I hope that helps.

    Regards,
    Ismael

    #251345

    yep ismael, that works – but after surfing some pages the logo link points to the same page your on.
    my knowledge of php is not so strong – but it seems like it needs a piece of code for outputing the home link on every page / post.
    do you know what i mean?

    also – the search form is missing in the main menu for logged in users

    • This reply was modified 3 months, 2 weeks ago by  basmati.
    • This reply was modified 3 months, 2 weeks ago by  basmati.
    #251826

    and i have another addition: i need one specific page where i need the same styling like on the logged-in user pages.
    is ot possible to extend the function with a page id – that shows the logged-in logo?

    * the logo header implementation is a little comlicated in enfold – i had several themes, where its build as background into the page titel. don’t you think that would be more flexible for customization … ?

    #251946

    Hi!

    Yes, use Ismaels code but replace:

    
    	if ( is_user_logged_in() ) {
        $logo = "<$headline_type class='logo bg-logo'><a href='".$link."'>".$loggedinlogo."$sub</a></$headline_type>";
    	} else {
    	$logo = "<$headline_type class='logo bg-logo'><a href='".$link."'>".$loggedoutlogo."$sub</a></$headline_type>";
    	}
    

    with

    
    	if ( is_user_logged_in() || is_page(array(20)) ) {
        $logo = "<$headline_type class='logo bg-logo'><a href='".get_home_url()."'>".$loggedinlogo."$sub</a></$headline_type>";
    	} else {
    	$logo = "<$headline_type class='logo bg-logo'><a href='".get_home_url()."'>".$loggedoutlogo."$sub</a></$headline_type>";
    	}
    

    instead of 20 insert the id of the page where you want to show the “logged in” logo. You can even insert several ids – just separate the with commas like 20,30,70.

    Regards,
    Peter

    #252226

    hey, thanks to all of you – function works well!

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

The topic ‘Change Logo for Logged in users’ is closed to new replies.