Skip to content

Commit

Permalink
CDPT-2228 Copying main theme to develop theme & various bug fixes. (#757
Browse files Browse the repository at this point in the history
)

* Copying main theme to develop theme & various bug fixes.

* Remove theme's environment notice.
  • Loading branch information
EarthlingDavey authored Oct 30, 2024
1 parent 9d21a71 commit 1dd8630
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 11 deletions.
7 changes: 0 additions & 7 deletions public/app/themes/clarity/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,3 @@
$search = new MOJ\Intranet\Search();
$search->hooks();

/// Prevent the Agency Switcher page from being overwritten
add_action('save_post', function ($post_id, $post) {
if ($post->post_name === 'agency-switcher') {
update_post_meta($post_id, '_wp_page_template', 'agency-switcher.php');
}
}, 99, 2);

7 changes: 7 additions & 0 deletions public/app/themes/clarity/inc/admin/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ function add_page_excerpts()
{
add_post_type_support('page', 'excerpt');
}

// Prevent the Agency Switcher page from being overwritten
add_action('save_post', function ($post_id, $post) {
if ($post->post_name === 'agency-switcher') {
update_post_meta($post_id, '_wp_page_template', 'agency-switcher.php');
}
}, 99, 2);
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
'delete_resource_categories' => true,
'opt_in_content' => true,
'unfiltered_html' => true,
'manage_prior_party_banners' => true,

// files
'export' => true,
Expand Down
11 changes: 9 additions & 2 deletions public/app/themes/clarity/inc/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ function is_valid_email_domain($login, $email, $errors)
function format_comment($comment, $args, $depth)
{
$post_type = get_post_type();
$GLOBALS['comment'] = $comment; ?>
$GLOBALS['comment'] = $comment;
$options = get_option('maintenance_options', [
'maintenance_mode_status' => 0,
'maintenance_mode_message' => '',
]);
$maintenance_mode = $options['maintenance_mode_status'] ?? false;
?>


<li <?= comment_class() ?> id="comment-<?= comment_ID() ?>">
<div class="comment-body" id="comment-<?= comment_ID() ?>">
Expand All @@ -74,7 +81,7 @@ function format_comment($comment, $args, $depth)
</cite>
<?php comment_text();

if ($post_type != 'condolences') { ?>
if ($post_type != 'condolences' && !$maintenance_mode) { ?>
<div class="reply">
<?php
$args['depth'] = $depth;
Expand Down
6 changes: 6 additions & 0 deletions public/app/themes/clarity/inc/post-types/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,10 @@ function mojintranet_sort_events($vars)
function mojintranet_clear_events_cache() {
global $wpdb;
$wpdb->query( "DELETE FROM `$wpdb->options` WHERE `option_name` LIKE ('_transient_event_get_events_%')" );

// If using persistent object cache, clear the cache here.
if(function_exists('wp_cache_flush')) {
// As there is no function to clear cache by 'keys that start with', we have to flush the whole cache.
wp_cache_flush();
}
}
2 changes: 2 additions & 0 deletions public/app/themes/clarity/page_media_grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

<h1 class="o-title o-title--page"><?php echo the_title(); ?></h1>

<?php do_action('before_media_grid_content'); ?>

<div class="l-full-page" role="main">

<?php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
<article class="c-events-item-byline">
<header>

<h3 class="c-events-item-byline__link"><a href="<?= $post_url ?? '' ?>"><?= $event_title ?? '' ?></a></h3>

<h3 class="c-events-item-byline__link"><a href="<?= $post_url ?? '' ?>"><?= $event_title ?? '' ?></a></h3>

<?php
if (empty($all_day)) {
Expand Down Expand Up @@ -47,3 +46,8 @@
</header>
</article>
<!-- c-events-item-byline ends here -->

<?php
// Unset variables to prevent leaking to following events in the loop.
unset($time);
unset($datetime);

0 comments on commit 1dd8630

Please sign in to comment.