How to add favicon in wordpress website?

Make sure you used this before </head>

If you have favicon as .ico format, you can use this code.

<link type="image/x-icon" rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/img/favicon.ico">

If you have favicon as png image format, you can use this code. Make sure your favicon size is 16x16px

<link rel="shortcut icon" type="image/png" href="<?php echo get_template_directory_uri(); ?>/img/favicon.png"/>

You can register favicon via functions.php too. See this code

function my_theme_add_favicon(){ ?>
    <!-- Custom Favicons -->
    <link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri();?>/img/favicon.ico"/>
    <?php }
add_action('wp_head','my_theme_add_favicon');

Dynamic wordpress menu

Register wordpress menu

add_action('init', 'my_theme_register_menu');
function my_theme_register_menu() {
	register_nav_menu( 'main-menu', 'Main Menu');
} 

// Default menu

function my_theme_default_menu() {
    echo '<ul id="nav">';
    if ('page' != get_option('show_on_front')) {
        echo '<li><a href="'. home_url() . '/">Home</a></li>';
    }
    wp_list_pages('title_li=');
        echo '</ul>';
}

Call menu where you need.

General:

<?php wp_nav_menu(array('theme_location' => 'main-menu', 'menu_id' => 'nav')); ?>

Dynamicaly

<?php
if (function_exists('my_theme_default_menu')) {
    wp_nav_menu(array('theme_location' => 'main-menu', 'menu_id' => 'nav', 'fallback_cb' => 'my_theme_default_menu'));
}
else {
    my_theme_default_menu();
}
?>

Register custom post & custom taxonomy in wordpress

Register custom post type

add_action( 'init', 'my_theme_custom_post' );
function my_theme_custom_post() {
	register_post_type( 'cpt',
		array(
			'labels' => array(
				'name' => __( 'CPTs' ),
				'singular_name' => __( 'CPT' )
			),
			'supports' => array('title', 'editor', 'custom-fields', 'thumbnail', 'page-attributes'),
			'public' => true
		)
	);
}

Register custom taxonomy

function my_theme_custom_post_taxonomy() {
	register_taxonomy(
		'cpt_cat',  
		'cpt',                  
		array(
			'hierarchical'          => true,
			'label'                 => 'CPT Category',  
			'query_var'             => true,
			'show_admin_column'     => true,
			'rewrite'               => array(
				'slug'              => 'cpt-category', 
				'with_front'    => true 
				)
			)
	);
}
add_action( 'init', 'my_theme_custom_post_taxonomy');