- shares
- Facebook Messenger
- Gmail
- Viber
- Skype
Đoạn snippet này sẽ giúp bạn hiển thị/thêm favicon trong Genesis Child Themes. Thay biểu tượng cho website bằng hình ảnh khác bạn muốn.
/** Adding custom Favicon */ add_filter( 'genesis_pre_load_favicon', 'custom_favicon' ); function custom_favicon( $favicon_url ) { return 'http://www.wpstuffs.com/images/favicon.png'; }
Chú ý: bạn có thể chèn đoạn code trên vào file functions.php của theme.
Nhúng Favicon URL có trên thư mục Website
Nếu bạn muốn trỏ tới favicon đã lưu trên website, có thể sử dụng đoạn code sau đây:
/** Adding custom Favicon */ add_filter( 'genesis_pre_load_favicon', 'custom_favicon' ); function custom_favicon( $favicon_url ) { return ''. trailingslashit( get_bloginfo('url') ) .'/wp-content/themes/child-theme-name/images/favicon.png'; }
Thay tên thư mục theme ‘child-theme-name’ bằng tên thư mục child theme của bạn. Chúc bạn thành công.
Hãy cho mình biết suy nghĩ của bạn trong phần bình luận bên dưới bài viết này. Hãy theo dõi kênh chia sẻ kiến thức WordPress của Hoangweb trên Twitter và Facebook
- shares
- Facebook Messenger
- Gmail
- Viber
- Skype