Jump to content

WHMCS Admin Favicon


zitu4life

Recommended Posts

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 😉

 

Link to comment
Share on other sites

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 by zitu4life
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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"/>';
});

LhGeZxg.png

possibly you might need to add... type="image/x-icon" into the link code, but i'm not seeing the need locally.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by zitu4life
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated