From db17984d058589a7aacc886fd0a3e0730d58f8dd Mon Sep 17 00:00:00 2001
From: Vencislav Atanasov
Date: Fri, 8 Sep 2023 13:31:19 +0300
Subject: [PATCH] Extract blog_slug detection to a new function
---
footer.php | 3 +--
functions.php | 7 ++++++-
header.php | 3 +--
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/footer.php b/footer.php
index a9ffd3f..6b40e07 100644
--- a/footer.php
+++ b/footer.php
@@ -15,8 +15,7 @@
path);
+ $blog_slug = get_blog_slug();
if ( $blog_slug != "2020" ) {
?>
diff --git a/functions.php b/functions.php
index 1307972..d8563a7 100644
--- a/functions.php
+++ b/functions.php
@@ -7,9 +7,14 @@ add_theme_support( 'automatic-feed-links' );
add_filter( 'the_excerpt', 'shortcode_unautop');
add_filter( 'the_excerpt', 'do_shortcode');
+function get_blog_slug() {
+ $blog_details = get_blog_details();
+ return trim($blog_details->path, '/');
+}
+
// OpenGraph image for FB/Twitter
function og_image( $tags ) {
- global $blog_slug;
+ $blog_slug = get_blog_slug();
$imagePath = __DIR__ . '/img/' . $blog_slug . '_fb_preview.jpg';
diff --git a/header.php b/header.php
index b2f6304..18df87c 100644
--- a/header.php
+++ b/header.php
@@ -24,8 +24,7 @@
path);
+ $blog_slug = get_blog_slug();
if ($blog_slug == '2019' || $blog_slug == '2020') {
echo '