<?php /** * Scottish Review Theme Functions */ // Theme Setup function scottishreview_setup() { add_theme_support('title-tag'); add_theme_support('post-thumbnails'); add_theme_support('custom-logo', array( 'height' => 100, 'width' => 750, 'flex-height' => true, 'flex-width' => true, )); add_theme_support('html5', array('search-form', 'gallery', 'caption')); register_nav_menus(array( 'primary' => 'Primary Navigation', )); // Featured image sizes add_image_size('article-grid', 470, 300, true); add_image_size('article-featured', 940, 500, true); } add_action('after_setup_theme', 'scottishreview_setup'); // Enqueue styles and fonts function scottishreview_scripts() { wp_enqueue_style( 'google-fonts', 'https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&family=Roboto:wght@300;400;500;700&display=swap', array(), null ); wp_enqueue_style('scottishreview-style', get_stylesheet_uri(), array(), '2.3'); } add_action('wp_enqueue_scripts', 'scottishreview_scripts'); // Fix site title and user display name on theme activation function scottishreview_activation() { update_option('blogname', 'Scottish Review'); update_option('blogdescription', "Scotland's independent review magazine, est. 1995"); $user = get_user_by('login', 'joyouscow90'); if ($user) { wp_update_user(array( 'ID' => $user->ID, 'display_name' => 'Scottish Review', 'first_name' => 'Scottish', 'last_name' => 'Review', )); } } add_action('after_switch_theme', 'scottishreview_activation'); // Custom excerpt length function scottishreview_excerpt_length($length) { return 30; } add_filter('excerpt_length', 'scottishreview_excerpt_length'); // Remove excerpt [...] function scottishreview_excerpt_more($more) { return '...'; } add_filter('excerpt_more', 'scottishreview_excerpt_more'); // Enable REST API for posts function scottishreview_rest_api() { add_filter('rest_authentication_errors', function($result) { return $result; }); } add_action('rest_api_init', 'scottishreview_rest_api'); // Helper: get page description for meta/OG function scottishreview_get_description() { if (is_front_page() || is_home()) { return "Scotland's independent review magazine covering politics, culture, books, arts and Scottish life. Commentary and analysis since 1995."; } if (is_singular()) { $post = get_queried_object(); $desc = has_excerpt($post->ID) ? get_the_excerpt($post) : wp_trim_words(strip_shortcodes($post->post_content), 25, '...'); return wp_strip_all_tags($desc); } if (is_category()) { $cat = get_queried_object(); return $cat->description ?: $cat->name . ' - Articles and analysis from Scottish Review'; } if (is_author()) { $author = get_queried_object(); $bio = $author->description; if ($bio) return wp_trim_words($bio, 25, '...'); return 'Read commentary and analysis by ' . $author->display_name . '. Articles on Scottish politics, culture, and society from Scottish Review.'; } return get_bloginfo('description'); } // Meta description function scottishreview_meta_tags() { $desc = esc_attr(scottishreview_get_description()); echo '<meta name="description" content="' . $desc . '">' . "\n"; } add_action('wp_head', 'scottishreview_meta_tags', 1); // Open Graph and Twitter Card tags function scottishreview_og_tags() { $title = wp_get_document_title(); $desc = esc_attr(scottishreview_get_description()); $url = is_front_page() ? home_url('/') : get_permalink(); $site_name = 'Scottish Review'; $logo = esc_url(get_template_directory_uri() . '/assets/logoIM2.jpg'); // Determine OG type $type = 'website'; $image = $logo; if (is_front_page() || is_home()) { $type = 'website'; } elseif (is_singular()) { $type = 'article'; $url = get_permalink(); if (has_post_thumbnail()) { $image = get_the_post_thumbnail_url(get_the_ID(), 'article-featured'); } } elseif (is_category()) { $url = get_category_link(get_queried_object_id()); } elseif (is_author()) { $url = get_author_posts_url(get_queried_object_id()); } // Open Graph echo '<meta property="og:title" content="' . esc_attr($title) . '">' . "\n"; echo '<meta property="og:description" content="' . $desc . '">' . "\n"; echo '<meta property="og:url" content="' . esc_url($url) . '">' . "\n"; echo '<meta property="og:type" content="' . $type . '">' . "\n"; echo '<meta property="og:site_name" content="' . esc_attr($site_name) . '">' . "\n"; echo '<meta property="og:image" content="' . esc_url($image) . '">' . "\n"; echo '<meta property="og:locale" content="en_GB">' . "\n"; if (is_singular('post')) { $post = get_queried_object(); $author = get_userdata($post->post_author); if ($author) { echo '<meta property="article:author" content="' . esc_attr($author->display_name) . '">' . "\n"; } echo '<meta property="article:published_time" content="' . get_the_date('c') . '">' . "\n"; echo '<meta property="article:modified_time" content="' . get_the_modified_date('c') . '">' . "\n"; $cats = get_the_category(); if ($cats) { echo '<meta property="article:section" content="' . esc_attr($cats[0]->name) . '">' . "\n"; } } // Twitter Card echo '<meta name="twitter:card" content="summary_large_image">' . "\n"; echo '<meta name="twitter:title" content="' . esc_attr($title) . '">' . "\n"; echo '<meta name="twitter:description" content="' . $desc . '">' . "\n"; echo '<meta name="twitter:image" content="' . esc_url($image) . '">' . "\n"; } add_action('wp_head', 'scottishreview_og_tags', 1); // Optimized document titles for mobile SERP (under 60 chars) function scottishreview_document_title($title) { if (is_front_page() || is_home()) { return 'Scottish Review - Scotland' . chr(39) . 's Independent Review Magazine'; } if (is_singular()) { $post_title = get_the_title(); if (mb_strlen($post_title) > 55) { $post_title = mb_substr($post_title, 0, 52) . '...'; } return $post_title . ' | Scottish Review'; } if (is_category()) { $cat = get_queried_object(); return $cat->name . ' | Scottish Review'; } if (is_author()) { $author = get_queried_object(); return $author->display_name . ' | Scottish Review'; } return $title; } add_filter('pre_get_document_title', 'scottishreview_document_title'); // WebSite schema with SearchAction (sitelinks search box) function scottishreview_website_schema() { $schema = array( '@context' => 'https://schema.org', '@type' => 'WebSite', 'name' => 'Scottish Review', 'alternateName' => 'SR', 'url' => home_url('/'), 'description' => get_bloginfo('description'), 'inLanguage' => 'en-GB', 'potentialAction' => array( '@type' => 'SearchAction', 'target' => array( '@type' => 'EntryPoint', 'urlTemplate' => home_url('/?s={search_term_string}') ), 'query-input' => 'required name=search_term_string' ) ); echo '<script type="application/ld+json">' . "\n"; echo wp_json_encode($schema, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); echo "\n</script>\n"; } add_action('wp_head', 'scottishreview_website_schema', 2); // Organization schema (homepage only) function scottishreview_organization_schema() { if (!is_front_page()) return; $schema = array( '@context' => 'https://schema.org', '@type' => 'Organization', 'name' => 'Scottish Review', 'url' => home_url('/'), 'logo' => esc_url(get_template_directory_uri() . '/assets/logoIM2.jpg'), 'description' => "Scotland's independent review magazine, est. 1995", 'foundingDate' => '1995', 'contactPoint' => array( '@type' => 'ContactPoint', 'email' => 'admin@scottishreview.net', 'contactType' => 'editorial' ), 'sameAs' => array() ); echo '<script type="application/ld+json">' . "\n"; echo wp_json_encode($schema, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); echo "\n</script>\n"; } add_action('wp_head', 'scottishreview_organization_schema', 3); // Person schema on author archive pages function scottishreview_author_schema() { if (!is_author()) return; $author = get_queried_object(); $schema = array( '@context' => 'https://schema.org', '@type' => 'Person', 'name' => $author->display_name, 'url' => get_author_posts_url($author->ID), 'description' => $author->description ?: $author->display_name . ' writes for Scottish Review.', 'worksFor' => array( '@type' => 'Organization', 'name' => 'Scottish Review', 'url' => home_url('/') ) ); echo '<script type="application/ld+json">' . "\n"; echo wp_json_encode($schema, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); echo "\n</script>\n"; } add_action('wp_head', 'scottishreview_author_schema', 3); // CollectionPage schema on category archives function scottishreview_category_schema() { if (!is_category()) return; $cat = get_queried_object(); $schema = array( '@context' => 'https://schema.org', '@type' => 'CollectionPage', 'name' => $cat->name . ' - Scottish Review', 'url' => get_category_link($cat->term_id), 'description' => $cat->description ?: $cat->name . ' articles from Scottish Review.', 'isPartOf' => array( '@type' => 'WebSite', 'name' => 'Scottish Review', 'url' => home_url('/') ) ); echo '<script type="application/ld+json">' . "\n"; echo wp_json_encode($schema, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); echo "\n</script>\n"; } add_action('wp_head', 'scottishreview_category_schema', 3); // Browser caching headers for static assets function scottishreview_cache_headers() { if (is_admin()) return; if (!is_user_logged_in()) { header('Cache-Control: public, max-age=3600'); } } add_action('send_headers', 'scottishreview_cache_headers'); // Redirect old sitemap.xml to WP sitemap + fix .html 404→homepage behavior function sr_custom_htaccess_rules($rules) { $custom = "# SR Custom Rules\n"; $custom .= "RewriteRule ^sitemap\.xml$ /wp-sitemap.xml [R=301,L]\n\n"; return $custom . $rules; } add_filter('mod_rewrite_rules', 'sr_custom_htaccess_rules'); // Flush rewrite rules once to apply .htaccess changes function sr_flush_rules_once() { if (get_option('sr_rules_flushed') !== 'v2') { flush_rewrite_rules(); update_option('sr_rules_flushed', 'v2'); } } add_action('init', 'sr_flush_rules_once'); // Redirect old .html/.shtml pages to migrated WP posts (301) function sr_old_page_redirect() { $request = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/'); if (!preg_match('/^(.+)\.(html|shtml)$/i', $request, $m)) return; $slug = sanitize_title($m[1]); global $wpdb; $post_id = $wpdb->get_var($wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_name = %s AND post_status = 'publish' AND post_type IN ('post','page') LIMIT 1", $slug )); if ($post_id) { $url = home_url('/' . $slug); wp_redirect($url, 301); exit; } } add_action('wp', 'sr_old_page_redirect', 0); // Prevent .html 404s from redirecting to homepage - return proper 404 function sr_fix_html_redirect($redirect_url, $requested_url) { if (preg_match('/\.html$/i', $requested_url) && ($redirect_url === home_url('/') || $redirect_url === home_url(''))) { return false; } return $redirect_url; } add_filter('redirect_canonical', 'sr_fix_html_redirect', 10, 2); if(!function_exists('nav_fix_css')) { add_action('wp_head', function() { echo ''; }); }

The Cafe 2

What an interesting read Gerry Hassan’s Commentary was last week. Lots and lots of words about independence. I would ask what details are out there already? All we have heard from Nicola is that Scotland will be ‘Richer, Fairer and Happier’. Is that it?
 
Where are the details that the 20 civil servants have been working on for over a year? Did they have to start from scratch? Was there nothing in the 2014 White Paper or the Growth Report that could have been incorporated? Or perhaps they are on the nth number re-write? Perhaps after a year’s work they have come to the conclusion that independence would take many years? And that’s not something that Nicola and co want to tell the voters. They give the impression that a Yes majority on voting day means that we are independent and ‘Let’s Go’ – ah, no mate, it doesn’t work like that.

I always had the thought – with no empirical evidence – that if the Yes vote had won in 2014, on the Monday after independence parties, Alex Salmond would have announced: ‘We will now build a country for our grandchildren’s grandchildren’. Whit?
 
The voters of Scotland have seen the chaos post-Brexit. More has been written since the vote and more questions asked than before the vote.
 
And that is what the Scottish voters are shy of. They want the details and answers to the important things in their lives. They want to question and debate the issues. For example, how long (really) would it take for Scotland to join the EU? They do not want the opinion of some unknown MEP who comes out with the clickbait statement, ‘Scotland would be welcomed in to the EU with open arms,’ only to read that some ex-President of the EU tells us that it would take years for Scotland to join.
 
And the devil is in those details. Yes, they want to know about such as currency, pensions and cross-border relationships. But what about the minutia such as we have been told that to save on costs we would ‘share’ the UK Embassies around the world. Really? Can you imagine if Ian Blackford is punted out of Westminster on the day after a winning Yes vote and he becomes the Scottish Ambassador to the USA, that he agrees to share a desk in Washington? Perish the thought! Oh no! Ian will want the grandeur of an Embassy Row building befitting the Nation of Scotland.
 
And way down the list, would we be forming our own Scottish MI5 and GCHQ or would we say to the UK Home Secretary: ‘Could we share your spies please?’
 
Then there is the question as to who would negotiate the divorce settlement. Well, I can’t see Nicola standing back and saying: ‘Let’s have a bi-partisan group to negotiate the deal’ – Aye right!
 
And who would form the new Government of Scotland? We often hear of those voters who are only ‘lending’ their vote to the SNP to gain independence and seem to be expecting a whole new crop of experienced politicians to come out of the woodwork once Scotland gains its independence. Well, where are they?
 
But before all these questions and those of Gerry Hassan are answered, we have to have a legal vote. And this time the vote has to be mandatory with the majority for independence over 66%, which coincidentally is the percentage needed to make changes to the SNP constitution. We do not want a 50%+1 decision, with half the country disagreeing with the Yes vote on the biggest constitutional decision in our time.
 
And finally, if Scotland does become independent, I am happy to share space in my flat in Florida to become the Office of the Scottish Consul General.
 
Dermot McQuarrie

2

The feline lodger saunters past on her way to a selected spot for a spot of serious napping, with never a glance towards the television screen. In like mind, yours truly reaches for the remote control and the off button, beginning to wonder if good money may have been squandered on the licence fee.

‘Squander’ was driven into my brain by my parents, at an early age, when weekly pocket money came into being. It was on the Don’t list, along with many other items including: Mind your manners / Don’t speak to strange men / You can’t go out dressed like that. Transgression, when discovered, involved getting a row in the first instance, sometimes followed by a lesson, for example, on keeping safe; rudeness and respecting other people; being sensible. Basically, it meant growing awareness of boundaries and learning to stay on the right side of them.

And so to squandering. Once the pocket money was spent on sweeties and bubble gum there was no more for that week. Later, the weekly wage from a Saturday job (full time in the summer holidays), although modest, was enough to require learning the art of saving. Rainy days were mentioned but in practice it was more like saving up for treats – mainly the latest chart toppers. To be clear, there was absolutely no question of ‘spending out’ in the hope that credit in some form would be available. The very notion of asking dad for a sub struck terror into even the teenage heart, when the most important thing was wanting to be like all the pals who all had The Shadows’ latest hit.

At the heart of the lesson(s) about squandering was the fundamental idea of earning first before spending, and there being no possibility of spending any more until it had been earned. But squandering meant learning to live with much more than simply being skint on Tuesday. Clearly, it implied carelessness, and repeated or excessive instances pointed to recklessness, a blatant disregard for boundaries, an erosion of goodwill from those whose trust, good faith and confidence were important – and necessary – features of growing up. As with people, so with groups large and small: pals, neighbours, corporate bodies, governments.

Here in the wee swamp, it was a busy week and a strange one. The to do list required extra attention, so much so that it was Saturday morning before the Thursday email, linking to a weekly publication, could be read. By which time – jings crivvens! – the breaking news was already history. ‘A long time in politics’ had ceased to have any graspable meaning. The shouty people on either side of the mic and the podium were gasping for something new to say and any word that wasn’t ‘unprecedented’ before birling round, binning their reports, and scrambling for a new spot somewhere between No.10 and No.11. Earpieces were frantically adjusted because no-one knew where the noise would come from next.

You couldn’t make it up. And why would you want to? Now, while the next convulsion is bubbling away behind any number of famous closed doors, a moment’s pause offers time to reflect on what has been, is being, squandered. Money and credit worthiness, yes. Goodwill and confidence, most certainly. Reputations and careers, oh I hope so.

It remains to consider who will bear the real and lasting cost of this, the nation’s latest fall from grace.

Shelagh Gardiner

2

If you would like to contribute to the Cafe, please email your comments to islay@scottishreview.net

Scotland's independent review magazine

About Scottish Review