-
AuthorPosts
-
May 19, 2020 at 8:46 pm #1214419
Hello,
I was able to do this once before and now I can’t find the code I used but I remember that it was pretty short and simple.What could I add to the functions.php file that would make the header logo point to https://www.yousio.com for users that are logged out?
But then have the logo point to http://www.yousio.com/activity after they log in
May 23, 2020 at 3:04 pm #1215486Hey bigwavebusiness,
Please have a look at the following thread:
https://kriesi.at/support/topic/change-logo-for-logged-in-users/If you need further assistance please let us know.
Best regards,
VictoriaMay 23, 2020 at 5:21 pm #1215537Hi Victoria,
I’m not the greatest with php (huge understatement lol) but that looks like it is to actually change the logo to a different image. I’m just trying to change the link associated with the logo.May 24, 2020 at 12:53 pm #1215706Hi bigwavebusiness,
The code here allows you to change the links for the logo:
https://kriesi.at/support/topic/change-logo-for-logged-in-users/#post-251039You need to place the links where Ismael pointed and add this code in your functions.php file in the child theme.
Best regards,
VictoriaMay 26, 2020 at 6:36 pm #1216576I tried what was supplied but I must have something wrong still as I’m getting an error on the last line saying unexpected ending. This is what I have:
// Change Logo Link For Logged In Users 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 src='https://yousio.com/wp-content/uploads/2020/05/Yousio-Flag-Logo-4.jpg' />"; $loggedoutlogo = "<img src='https://yousio.com/wp-content/uploads/2020/05/Yousio-Flag-Logo-4.jpg' />"; if ( is_user_logged_in() ) { $logo = "<$headline_type class='logo bg-logo'><a href='https://yousio.com'>".$loggedinlogo."$sub</a></$headline_type>"; } else { $logo = "<$headline_type class='logo bg-logo'><a href='https://yousio.com/home/'>".$loggedoutlogo."$sub</a></$headline_type>"; }
I added this in another thread but I also can’t access the Customize Theme page to be able to change what the intended home page is and instead I’m getting this error when trying to access https://yousio.com/wp-admin/customize.php?return=%2Fwp-admin%2Fupload.php
Fatal error: Uncaught Error: Call to undefined function gutenberg_can_edit_post_type() in /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php:563 Stack trace: #0 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(423): Avia_Gutenberg->can_use_block_editor(‘post’, true) #1 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(458): Avia_Gutenberg->init_force_classic_post_types() #2 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(533): Avia_Gutenberg->get_force_classic_post_types() #3 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(671): Avia_Gutenberg->force_classic_editor(‘page’) #4 /home2/activ111/yousio.com/wp-includes/class-wp-hook.php(287): Avia_Gutenberg->handler_display_post_states(Array, Object(WP_Post)) #5 /home2/activ111/yousio.com/wp-includes/plugin.php(206): WP_Hook->apply_filters(Array, Array) #6 in /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php on line 563
There has been a critical error on your website. Please check your site admin email inbox for instructions.
- This reply was modified 4 years, 7 months ago by bigwavebusiness.
May 26, 2020 at 8:15 pm #1216654Hi bigwavebusiness,
You lost the closing bracket and why are you adding the same logo? It defeats the purpose of adding this code.
Please try like this:
// Change Logo Link For Logged In Users 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 src='https://yousio.com/wp-content/uploads/2020/05/Yousio-Flag-Logo-4.jpg' />"; $loggedoutlogo = "<img src='https://yousio.com/wp-content/uploads/2020/05/Yousio-Flag-Logo-4.jpg' />"; if ( is_user_logged_in() ) { $logo = "<$headline_type class='logo bg-logo'><a href='https://yousio.com'>".$loggedinlogo."$sub</a></$headline_type>"; } else { $logo = "<$headline_type class='logo bg-logo'><a href='https://yousio.com/home/'>".$loggedoutlogo."$sub</a></$headline_type>"; } }
Best regards,
VictoriaMay 26, 2020 at 8:18 pm #1216659I don’t want to change the logo. Only the link associated for logged in users.
And the other error?
May 26, 2020 at 9:15 pm #1216686Also, the fix you gave me made the Logo disappear
May 26, 2020 at 9:26 pm #1216689Try this:
add_filter('avf_logo_link','av_change_logo_link'); function av_change_logo_link($link){ if ( is_user_logged_in() ) { $link = "url1"; } if ( !is_user_logged_in() ) { $link = "url2"; } return $link; }
May 26, 2020 at 9:38 pm #1216693Thanks Guenni007!
I’m sorry but witch side of that is logged in and which is logged out?
I’m trying to make it so that if you are not logged in and you click on the header logo it takes you to yousio.com/home
But once you login the logo takes you to yousio.com/activityI have no idea what is causing the other error listed above but it is keeping me from being able to edit the theme so I currently can’t set a static homepage.
May 26, 2020 at 9:55 pm #1216697And that is really hard to understand?
is_user_logged_in is if the user is logged in.the ! is a not logic
add_filter('avf_logo_link','av_change_logo_link'); function av_change_logo_link($link){ if ( is_user_logged_in() ) { $link = "https://yousio.com/activity"; } if ( !is_user_logged_in() ) { $link = "https://yousio.com/"; } return $link; }
but for not logged in users this is normal behavior so you might get rid of the default setting:
add_filter('avf_logo_link','av_change_logo_link'); function av_change_logo_link($link){ if ( is_user_logged_in() ) { $link = "https://yousio.com/activity"; } return $link; }
try yourself.
- This reply was modified 4 years, 7 months ago by Guenni007.
May 26, 2020 at 10:12 pm #1216702Well, I’m not a programmer so pretty much any php is difficult to understand but that is changing the links. Thank you
But something is still forcing the user to the activity page if they are not logged in. If you try to access the url in any way it is forcing back to activity.
https://yousio.com/loggedout ( I changed the page to reduce confusion)
May 26, 2020 at 11:20 pm #1216712hm :
have you tried that on top:
add_filter('avf_logo_link','av_change_logo_link'); function av_change_logo_link($link){ if ( is_user_logged_in() ) { $link = "https://yousio.com/activity"; } if ( !is_user_logged_in() ) { $link = "https://yousio.com/"; } return $link; }
maybe you set the wordpress setup wrong – because i do not see any difference on the homepage and the activity page ( yes i’m not logged in)
when klicking on the activity button in your menu. If there is a difference there migth be two different pages ! ?what did you declare as frontpage ( if it is the activity page then it is clear )
Yes i can see that there is different pages ( different page-ids ) but the content seems to me identical.
I see only different sidebars. But they do change on reload too.May 26, 2020 at 11:50 pm #1216722That’s what the home page should look like for a logged out user. The only way I can access it is by going to edit the page and hitting preview.
But something is forcing everything to activity. What? I’m at a total loss right now
May 26, 2020 at 11:57 pm #1216723Woohooo, I got it working. The setting in Appearance > Customize for what the homepage is was overriding the Enfold setting. I ended up having to switch to a different theme and save the correct page and then switch back to Enfold.
The other error was preventing me from doing it before by blocking the page. Any thoughts on what is causing this error?
Fatal error: Uncaught Error: Call to undefined function gutenberg_can_edit_post_type() in /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php:563 Stack trace: #0 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(423): Avia_Gutenberg->can_use_block_editor(‘post’, true) #1 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(458): Avia_Gutenberg->init_force_classic_post_types() #2 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(533): Avia_Gutenberg->get_force_classic_post_types() #3 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(671): Avia_Gutenberg->force_classic_editor(‘page’) #4 /home2/activ111/yousio.com/wp-includes/class-wp-hook.php(287): Avia_Gutenberg->handler_display_post_states(Array, Object(WP_Post)) #5 /home2/activ111/yousio.com/wp-includes/plugin.php(206): WP_Hook->apply_filters(Array, Array) #6 in /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php on line 563
There has been a critical error on your website. Please check your site admin email inbox for instructions.
June 3, 2020 at 3:15 pm #1219098Hi,
Glad to know that you managed to make it work. If you have any additional questions at this time we kindly ask that you open them up in a separate thread. The longer threads get in the forum, they become more difficult to support as they tend to drift off topic and they also make it troublesome for users trying to search for solutions. Keeping threads relevant to their original inquiry ensures that we can keep better track of what has been resolved and that users can more effectively find answers to similar issues they might be experiencing.
Thanks!
Best regards,
Ismael -
AuthorPosts
- The topic ‘Changing the link for the main logo for logged out users’ is closed to new replies.