Extract blog_slug detection to a new function
This commit is contained in:
parent
6a27f51189
commit
db17984d05
|
@ -15,8 +15,7 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
$blog_details = get_blog_details();
|
$blog_slug = get_blog_slug();
|
||||||
$blog_slug = str_replace('/', '', $blog_details->path);
|
|
||||||
if ( $blog_slug != "2020" ) {
|
if ( $blog_slug != "2020" ) {
|
||||||
?>
|
?>
|
||||||
<div class="col4">
|
<div class="col4">
|
||||||
|
|
|
@ -7,9 +7,14 @@ add_theme_support( 'automatic-feed-links' );
|
||||||
add_filter( 'the_excerpt', 'shortcode_unautop');
|
add_filter( 'the_excerpt', 'shortcode_unautop');
|
||||||
add_filter( 'the_excerpt', 'do_shortcode');
|
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
|
// OpenGraph image for FB/Twitter
|
||||||
function og_image( $tags ) {
|
function og_image( $tags ) {
|
||||||
global $blog_slug;
|
$blog_slug = get_blog_slug();
|
||||||
|
|
||||||
$imagePath = __DIR__ . '/img/' . $blog_slug . '_fb_preview.jpg';
|
$imagePath = __DIR__ . '/img/' . $blog_slug . '_fb_preview.jpg';
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
$blog_details = get_blog_details();
|
$blog_slug = get_blog_slug();
|
||||||
$blog_slug = str_replace('/', '', $blog_details->path);
|
|
||||||
|
|
||||||
if ($blog_slug == '2019' || $blog_slug == '2020') {
|
if ($blog_slug == '2019' || $blog_slug == '2020') {
|
||||||
echo '<nav style="background: url(\''.get_template_directory_uri().'/img/navbg-'.$blog_slug.'.png\'); height: 84px">';
|
echo '<nav style="background: url(\''.get_template_directory_uri().'/img/navbg-'.$blog_slug.'.png\'); height: 84px">';
|
||||||
|
|
Loading…
Reference in New Issue