This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// VERSION 1 - Show 65d 2h 21m 57s | |
<p id="countdownTimer"></p> | |
<script type="text/javascript"> | |
function updateCountdown() { | |
// Set the target date and time | |
var targetDate = new Date('March 16, 2024 12:00:00').getTime(); | |
// Get the current date and time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** Disable the singular post page for CPT | |
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
add_action( 'template_redirect', 'wsv_redirect_cpt' ); | |
function wsv_redirect_cpt() { | |
if ( is_singular( 'cpt' )) { | |
wp_redirect( '/', 301 ); | |
exit; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https: //gist.github.com/Nerd-Rush/294f491cc1211903b40f7370ad6081aa | |
function custom_admin_notice_with_logo() { | |
$user_id = get_current_user_id(); | |
if (get_user_meta($user_id, 'custom_notice_dismissed', true) !== 'yes') { | |
if (current_user_can('administrator') || current_user_can('editor')) { | |
$nonce = wp_create_nonce('custom_notice_dismiss_nonce'); | |
$image_url = 'https://nerdrush.com/wp-content/uploads/2023/08/Nerd-Rush-Logo-Blue-2023.svg'; // External image URL | |
?> | |
<div class="notice notice-warning custom-notice" style="padding-top: 20px;"> | |
<img src="<?php echo esc_url( $image_url ); ?>" alt="Logo" style="width: 120px; display: block; margin-bottom: 10px;"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Facts Data | |
<?php if( have_rows('facts_data') ): ?> | |
<?php while( have_rows('facts_data') ): the_row(); | |
// Get sub field values. | |
$type = get_sub_field('facts_data_type'); | |
$value = get_sub_field('facts_data_value'); | |
?> | |
<div class="gb-container facts-data-wrapper"> | |
<p class="gb-headline facts-data-type gb-headline-text"><?php echo esc_html($type); ?>: <span class="facts-data-value"><?php echo esc_html($value); ?></span></p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Dynamic font sizing with media queries | |
<script type="text/javascript"> | |
function adjustFontSizeAndLineHeight() { | |
var elements = document.getElementsByClassName('stats-data-value'); | |
for (var i = 0; i < elements.length; i++) { | |
var length = elements[i].innerText.length; | |
var isSmallScreen = window.innerWidth <= 1024; | |
let fontSize; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** Disable the editor for Private Pages CPT in the Client Portal plugin | |
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
function wsv_disable_editor_for_private_page() { | |
remove_post_type_support( 'private-page', 'editor' ); | |
} | |
add_action( 'init', 'wsv_disable_editor_for_private_page' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** Show Featured Images in admin columns | |
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
// Add filters for 'post' post type. | |
add_filter('manage_posts_columns', 'wsv_add_thumbnail_column', 5); | |
add_action('manage_posts_custom_column', 'wsv_display_thumbnail_column', 5, 2); | |
// Add filters for 'page' post type. | |
add_filter('manage_pages_columns', 'wsv_add_thumbnail_column', 5); | |
add_action('manage_pages_custom_column', 'wsv_display_thumbnail_column', 5, 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place in footer | |
<script type="text/javascript"> | |
// GA4 track external links | |
$(document).on('click', function(e) { | |
if (e.target.href && e.target.href.indexOf(window.location.hostname) < 0) { | |
gtag('event', 'click', { | |
'event_category': 'Outbound Link', | |
'event_label': e.target.href, | |
'transport_type': 'beacon', |