Tagged: x
-
AuthorPosts
-
October 31, 2016 at 5:07 pm #1238416
tunedotcomParticipantI need to add a specific data attribute to the site’s logo image in the nav for google tag manager purposes. I was able to use
nav_menu_link_attributesto manipulate the nav but can’t find a solution for the logo. Any help is appreciated, thanks.October 31, 2016 at 10:07 pm #1238666
Prasant RaiModeratorHello There,
Thanks for writing in!
Can you please provide the URL of your website so we can see your current setup and suggest you a solution accordingly?
Thanks.
November 1, 2016 at 12:09 am #1238736
tunedotcomParticipantYes, it’s tune.com. Thanks.
November 1, 2016 at 3:39 am #1238861
Paul RModeratorHi,
You can create the file _brand.php in wp-content/themes/x-child/framework/views/global then copy the code below into that file
<?php // ============================================================================= // VIEWS/GLOBAL/_BRAND.PHP // ----------------------------------------------------------------------------- // Outputs the brand. // ============================================================================= $site_name = get_bloginfo( 'name' ); $site_description = get_bloginfo( 'description' ); $logo = x_make_protocol_relative( x_get_option( 'x_logo' ) ); $site_logo = '<img src="' . $logo . '" alt="' . $site_description . '">'; ?> <?php echo '<h1 class="visually-hidden">' . $site_name . '</h1>'; ?> <a href="<?php echo home_url( '/' ); ?>" class="<?php x_brand_class(); ?>" title="<?php echo $site_description; ?>"> <?php echo ( $logo == '' ) ? $site_name : $site_logo; ?> </a>You can add your data attribut on this line of code.
$site_logo = '<img src="' . $logo . '" alt="' . $site_description . '">';eg.
$site_logo = '<img data="YOUR DATA HERE" src="' . $logo . '" alt="' . $site_description . '">';Hope that helps.
November 1, 2016 at 3:52 pm #1239797
tunedotcomParticipantThank you. That worked out well 🙂
November 1, 2016 at 7:59 pm #1240087
NicoModeratorHappy to hear that.
Feel free to ask us again.
Thanks.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1238416 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
