Title: Shortcode in header template
Last modified: October 22, 2020

---

# Shortcode in header template

 *  Resolved [Shalom Cohen](https://wordpress.org/support/users/s_coh/)
 * (@s_coh)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-header-template/)
 * Hello,
    I put the shortcode in the header template header.php <div id=”hcontrast”
   class=”contrast-button”><?php echo do_shortcode( ‘[wpa_toolbar]’ ); ?></div> 
   when i press on the contrast icon in the header every thing work fine but when
   i move to another page i c’ant disable the contrast after the page is reloded
 * Thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fshortcode-in-header-template%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Joe Dolson](https://wordpress.org/support/users/joedolson/)
 * (@joedolson)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-header-template/#post-13569882)
 * What browser are you using? I just tried to recreate this on your site using 
   Firefox and wasn’t able to reproduce the issue.
 *  Thread Starter [Shalom Cohen](https://wordpress.org/support/users/s_coh/)
 * (@s_coh)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-header-template/#post-13571816)
 * I using chrome but the problem apear also in firefox.
    I solved that with this
   code: const hcb = document.querySelector(‘#hcontrast .a11y-toolbar-widget .toggle-
   contrast’) if(document.body.classList.contains(‘contrast’)) { hcb.setAttribute(‘
   id’, ‘is_high_contrast’) }
 *  Plugin Author [Joe Dolson](https://wordpress.org/support/users/joedolson/)
 * (@joedolson)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-header-template/#post-13574447)
 * Sounds good! I’ll consider this resolved, then.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Shortcode in header template’ is closed to new replies.

 * ![](https://ps.w.org/wp-accessibility/assets/icon-256x256.png?rev=1097582)
 * [WP Accessibility](https://wordpress.org/plugins/wp-accessibility/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-accessibility/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-accessibility/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-accessibility/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-accessibility/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-accessibility/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Joe Dolson](https://wordpress.org/support/users/joedolson/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-header-template/#post-13574447)
 * Status: resolved