Adding shortcode to header.php
-
Hi Todd, love WOP — trying to add a Text Widget to a site using a child theme of Twenty Seventeen. It is to be a custom tagline up on the hero image. I can’t get it to render whatsoever — is there a specific protocol I should follow to get that text to overlay that header image?
Here’s what I did:
- created a WOP named ‘homepage-mission’
- added my text sentence into that Text Widget under:
[widgets_on_pages id=”homepage-mission”] in: Appearance > Widgets - in header.php, I added the middle line of code:
<?php get_template_part( 'template-parts/header/header', 'image' ); ?> <div class="mission-widget"><?php do_shortcode( '[widgets_on_pages id="homepage-mission"]' ); ?></div> <?php if ( has_nav_menu( 'top' ) ) : ?>
… and I get Nothing. Can you guide me toward getting that widget to show in the header?
Thanks in advance!
Steve C.
3Cstudio
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Adding shortcode to header.php’ is closed to new replies.