Adding icon links

To make our theme more easily portable, we need to add links for the favicon.ico and apple-touch-icon-precomposed.png files in the head.php template file:

  1. Open the head.php file in the templates folder.
    Adding icon links
  2. Add links to our favicon.ico and apple-touch-icon-precomposed.png files using the WordPress PHP function get_template_directory_uri() to begin the file path. Then, reach into our ico folder inside the assets folder for the files shown as follows:
    <!-- Icons -->
    <link rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/assets/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" href="<?php echo get_template_directory_uri(); ?>/assets/ico/apple-touch-icon-precomposed.png">
  3. Save and refresh the file, and depending on your browser's behavior, you should see your favicon appear.

    Here is the screenshot of my resulting favicon in the Google Chrome browser:

    Adding icon links

Now we just need to attend to a couple of last details to address the specific needs of a WordPress theme.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset