// ============================================================
// فاوآیکون سایت (سازگار با وردپرس، ردوکس و تصویر پیشفرض قالب)
// ============================================================
function raditone_output_favicon() {
if ( function_exists( 'has_site_icon' ) && has_site_icon() ) {
return; // وردپرس خودش آیکون را در wp_head خروجی میدهد
}
$favicon = function_exists( 'raditone_get_opt' ) ? raditone_get_opt( 'favicon' ) : null;
$favicon_url = '';
if ( is_array( $favicon ) && ! empty( $favicon['url'] ) ) {
$favicon_url = $favicon['url'];
} elseif ( is_string( $favicon ) && ! empty( $favicon ) ) {
$favicon_url = $favicon;
}
if ( empty( $favicon_url ) && file_exists( get_template_directory() . '/assets/images/favicon.png' ) ) {
$favicon_url = get_template_directory_uri() . '/assets/images/favicon.png';
}
if ( ! empty( $favicon_url ) ) {
echo '' . "\n";
echo '' . "\n";
}
}
add_action( 'wp_head', 'raditone_output_favicon', 1 );