0) {
if (has_post_thumbnail($front_page_id)) {
$thumb = wp_get_attachment_image_url(get_post_thumbnail_id($front_page_id), 'full');
if (!empty($thumb)) {
return $thumb;
}
}
$front = get_post($front_page_id);
if ($front instanceof WP_Post && !empty($front->post_content)) {
if (preg_match('/
]+src=["\\\']([^"\\\']+)["\\\']/i', $front->post_content, $m)) {
return $m[1];
}
}
}
$custom_logo_id = (int) get_theme_mod('custom_logo');
if ($custom_logo_id) {
$logo = wp_get_attachment_image_url($custom_logo_id, 'full');
if (!empty($logo)) {
return $logo;
}
}
return get_site_icon_url(512) ?: '';
}
function fl_seo_metadata_head() {
if (is_admin()) return;
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
$siteName = get_bloginfo('name');
$siteDescription = get_bloginfo('description');
if (is_front_page()) {
$homepageImage = fl_get_homepage_social_image_url();
if (!empty($homepageImage)) {
$projectImageUrl = $homepageImage;
}
}
$metaDescription = !empty($projectDescription) ? $projectDescription : $siteDescription;
$metaTitle = is_front_page() ? $siteName : get_the_title() . ' | ' . $siteName;
// Determine the current URL more accurately
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
$current_url = $protocol . $host . $_SERVER['REQUEST_URI'];
?>