Custom favicon sizes for CakePHP


Generate your icon here for different sizes :https://www.favicon-generator.org/

Put your images/icons inside webroot/ico directory. If you use theme/plugin, put it inside the webroot/ico of the theme


Open your default.ctp and put this code inside <head></head>:



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<head>
<?php
    echo $this->Html->meta('android-icon-36x36.png', '/ico/android-icon-36x36.png', ['type' => 'icon']);
    echo $this->Html->meta('apple-icon-57x57.png', '/ico/apple-icon-57x57.png', ['type' => 'icon', 'sizes' => '57x57']);
    echo $this->Html->meta('apple-icon-72x72.png', '/ico/android-icon-72x72.png', ['type' => 'icon', 'sizes' => '72x72']);
    echo $this->Html->meta('apple-icon-76x76.png', '/ico/apple-icon-76x76.png', ['type' => 'icon', 'sizes' => '76x76']);
    echo $this->Html->meta('apple-icon-114x114.png', '/ico/apple-icon-114x114.png', ['type' => 'icon', 'sizes' => '114x114']);
    echo $this->Html->meta('apple-icon-120x120.png', '/ico/apple-icon-120x120.png', ['type' => 'icon', 'sizes' => '120x120']);
    echo $this->Html->meta('apple-icon-144x144.png', '/ico/apple-icon-144x144.png', ['type' => 'icon', 'sizes' => '144x144']);
    echo $this->Html->meta('apple-icon-152x152.png', '/ico/apple-icon-152x152.png', ['type' => 'icon', 'sizes' => '152x152']);
?>
</head>

Comments