Tagged: logo
-
AuthorPosts
-
April 14, 2014 at 10:34 am #250979
Hi, i’d like to change the style for logged-in users.
how can i change the logo only for logged in users?April 14, 2014 at 1:40 pm #251039Hi 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,
IsmaelApril 14, 2014 at 10:52 pm #251345yep 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 10 years, 7 months ago by basmati.
April 15, 2014 at 10:36 pm #251826and 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 … ?
April 16, 2014 at 7:04 am #251946Hi!
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,
PeterApril 16, 2014 at 5:28 pm #252226hey, thanks to all of you – function works well!
-
AuthorPosts
- The topic ‘Change Logo for Logged in users’ is closed to new replies.