zitu4life Posted January 2, 2020 Share Posted January 2, 2020 Hello there I have saw out there that is possible to add Favicon on client area and also there is whmcs doc for that but admin Favicon there is no documentation, also there is no thread on this community explain how to do that. I have search on google and find on Brazilian website this hook, I did not give it a try yet. So I can assume a hook could be used to add favicon on WHMCS admin. // Favicon in admin panel add_hook('AdminAreaHeadOutput', 1, function($vars) { $gofas_admin_favicon = array(); $gofas_admin_favicon['gofas_admin_favicon'] = '<link rel="icon" href="https://www.example.com/favicon-mini-32x32.png" sizes="32x32" /> <link rel="icon" href="https://www.example.com/favicon-medium-192x192.png" sizes="192x192" /> <link rel="apple-touch-icon-precomposed" href="https://www.example.com/favicon-large-300x300.png" /> <meta name="msapplication-TileImage" content="https://www.example.com/favicon-large-300x300.png" />'; return $gofas_admin_favicon['gofas_admin_favicon']; }); There is any improved way to add favicon now a days? Sometimes I have a lot of pages opened, so favicon really helps identifying my own website easily and also having favicon makes websites more friendly 😉 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted January 2, 2020 Share Posted January 2, 2020 The hook should work. I don't see any problem with it. 1 Quote Link to comment Share on other sites More sharing options...
zitu4life Posted January 3, 2020 Author Share Posted January 3, 2020 (edited) Thank you @Kian So is it possible to reduce that hook to be more simple? Maybe you would like to take a look at it too @brian! // Favicon in admin panel add_hook('AdminAreaHeadOutput', 1, function($vars) { $gofas_admin_favicon = array(); $gofas_admin_favicon['gofas_admin_favicon'] = '<link rel="icon" href="https://www.zitu4lifedomain.com/favicon-mini-16x16.ico" sizes="32x32" />'; return $gofas_admin_favicon['gofas_admin_favicon']; }); My favicon format is .ico instead of .png and also i just want to upload it on my installation . how could it be done. what modification I need to do ? Do i need all those url for others devices ? I just want to upload 1 favicon sized 16x16 <link rel="icon" href="https://www.example.com/favicon-medium-192x192.png" sizes="192x192" /> <link rel="apple-touch-icon-precomposed" href="https://www.example.com/favicon-large-300x300.png" /> <meta name="msapplication-TileImage" content="https://www.example.com/favicon-large-300x300.png" />'; return $gofas_admin_favicon['gofas_admin_favicon']; }); Many thanks Edited January 3, 2020 by zitu4life 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 3, 2020 Share Posted January 3, 2020 1 hour ago, zitu4life said: So is it possible to reduce that hook to be more simple? Maybe you would like to take a look at it too @brian! you could cut the number of lines, e.g instead of declaring an array and returning it, just return the string. 1 hour ago, zitu4life said: My favicon format is .ico instead of .png and also i just want to upload it on my installation . how could it be done. what modification I need to do ? you should just need to change the filename in the link - that's all. 1 hour ago, zitu4life said: Do i need all those url for others devices ? I just want to upload 1 favicon sized 16x16 if you're not going to view your admin area via mobile devices, or at least don't need to see facicons when doing so, then you won't need those middle 2 lines - just the first and the return. 1 Quote Link to comment Share on other sites More sharing options...
zitu4life Posted January 5, 2020 Author Share Posted January 5, 2020 I have tested that hook and do not work for favicon format .ico and .png , I suspect could be some issue with that hook, can you please test it on your dev @brian! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 5, 2020 Share Posted January 5, 2020 if you cut the hook down to it's absolute simplest, then it works for me (obviously change the URL to the path of your favicon!)... <? add_hook('AdminAreaHeadOutput', 1, function($vars) { return '<link rel="icon" href="https://www.domain.com/favicon.ico"/>'; }); possibly you might need to add... type="image/x-icon" into the link code, but i'm not seeing the need locally. 1 Quote Link to comment Share on other sites More sharing options...
zitu4life Posted January 5, 2020 Author Share Posted January 5, 2020 7 hours ago, brian! said: if you cut the hook down to it's absolute simplest, then it works for me (obviously change the URL to the path of your favicon!)... Thank you! It works, but on admin login page still now the only page with no favicon . Login page has something special on it? There is a way to make admin login page has a favicon too. Now I have favicon on client area, on admin area but not on admin login page. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 6, 2020 Share Posted January 6, 2020 13 hours ago, zitu4life said: Thank you! It works, but on admin login page still now the only page with no favicon . Login page has something special on it? no it lacks something - it isn't an admin area page and therefore isn't designed to accept the values from the hook that will work on the admin pages... 13 hours ago, zitu4life said: There is a way to make admin login page has a favicon too. just adding it to the login.tpl template would be the simplest way... it will get overwritten during an update, so you'll just have to remember to put it back afterwards. 1 Quote Link to comment Share on other sites More sharing options...
zitu4life Posted January 6, 2020 Author Share Posted January 6, 2020 (edited) 2 hours ago, brian! said: just adding it to the login.tpl template would be the simplest way... it will get overwritten during an update, so you'll just have to remember to put it back afterwards. At the begging I did not realized what code to add exactly to login.tpl file, but after small dig on google I made it works. <link rel="icon" href="https://zitu4lifedomain.com/favico_zitu4life.ico" type="image/x-icon"/> 😊 My website starts looking more professional now 😊 These days google are showing favicon on search, so it is nice have favicon Edited January 6, 2020 by zitu4life 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 6, 2020 Share Posted January 6, 2020 3 minutes ago, zitu4life said: At the begging I did not realized what code to add exactly to login.tpl file, but after small dig on google I made it works. you should have just needed to copy the link line of code from the hook - I probably should have made that bit clear to you. 🙂 all the hook does is insert this favicon html code into the header template for you... but with the login page, you'll do it manually. 1 Quote Link to comment Share on other sites More sharing options...
MikePitta Posted April 21, 2023 Share Posted April 21, 2023 Hi. It used to, but it seems that this code does not work any more, maybe for the update to php 8.1? Any update? <? add_hook('AdminAreaHeadOutput', 1, function($vars) { return '<link rel="icon" href="https://www.domain.com/favicon.ico"/>'; }); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.