Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 89ad372

Browse files
authoredAug 5, 2024··
Merge pull request #4 from ITS-Digital-Technology/feature/add-trustarc-code
Fix "unexpected output" bug and tweak TrustArc link formatting
2 parents 1d31d3e + fdb9909 commit 89ad372

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed
 

‎nu_global_elements.php

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22
/*
33
Plugin Name: Northeastern Global Elements
4-
Plugin URI: https://northeastern.netlify.app/pattern-library/page-chrome/global-elements/
4+
Plugin URI: https://github.com/ITS-Digital-Technology/global-elements-wordpress
55
Description: Inserts the Northeastern University global header, footer, and TrustArc cookie consent manager. Requires wp_body_open() under the body tag to display the global header.
66
Author: Northeastern University ITS Web Solutions
77
Author URI: https://its.northeastern.edu
8-
Version: 1.2.1
8+
Version: 1.2.2
99
*/
1010

1111
/**
@@ -17,11 +17,13 @@
1717
/**
1818
* Include global elements CSS, kernl UI and javascript from CDN
1919
*/
20-
echo '
20+
add_action('wp_head', function() {
21+
echo '
2122
<link rel="stylesheet" href="https://global-packages.cdn.northeastern.edu/global-elements/dist/css/index.css">
2223
<script src="https://global-packages.cdn.northeastern.edu/global-elements/dist/js/index.umd.js"></script>
2324
<script src="https://global-packages.cdn.northeastern.edu/kernl-ui/dist/js/index.umd.js" defer></script>
2425
';
26+
});
2527

2628
/**
2729
* Include the global NU header, if it is not disabled in the options
@@ -57,22 +59,18 @@
5759
/**
5860
* Include TrustArc, if it is not disabled in the options
5961
*/
60-
6162
if (!isset($nu_global_elements_options['disable_trustarc'])){
62-
if (!isset($nu_global_elements_options['disable_global_footer'])){
63-
add_action('wp_footer', function() {
64-
echo '<div x-data="NUGlobalElements.trustarc()" x-init="init()"></div>';
65-
});
66-
}
67-
else {
63+
64+
if (isset($nu_global_elements_options['disable_global_footer'])){
6865
add_action('wp_footer', function() {
69-
echo '<style>#trustarc-no-ge-footer footer {padding-top: .7rem !important; text-align: center !important;}</style>';
70-
echo '<div id="trustarc-no-ge-footer" x-data="NUGlobalElements.trustarc()" x-init="init()"></div>';
71-
});
66+
echo '<style>#trustarc-global-element footer {padding-top: .6rem !important;} #trustarc-global-element footer a {color: #ccc; text-decoration: none;}</style>';
67+
});
7268
}
69+
add_action('wp_footer', function() {
70+
echo '<div id="trustarc-global-element" x-data="NUGlobalElements.trustarc()" x-init="init()"></div>';
71+
});
7372
}
7473

75-
7674
/**
7775
* Create plugin settings/options menu item, page and fields
7876
*

0 commit comments

Comments
 (0)
Please sign in to comment.