zumbuluk
Forum Replies Created
-
Hi, just to clarify, ?hould I also be doing something else? I’ve created a data-layer variable in GTM, but it doesn’t really make sense without the field, right?
Thank you so much!
However, I’ve tried using it and here’s what my function.php in the child theme looks like (along with the css reference):<?php add_action( 'wp_head', 'my_datalayer_variables', 10 ); function my_datalayer_variables( $dataLayer ) { $_gtm4wp_userid = get_current_user_id(); $_gtm4wp_nickname = get_user_meta($_gtm4wp_userid, 'nickname', true); $dataLayer["nickname"] = $_gtm4wp_nickname; return $dataLayer; } add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); } ?>
but the nickname isn’t showing up. You can take a look on https://www.talesofyore.com. For login purposes, please use:
username: Test
password: testHi, I’m trying to figure out how to put together this code in the frontend.php
I’ve triedif ( $gtm4wp_options[ GTM4WP_OPTION_INCLUDE_NICKNAME ] ) { $_gtm4wp_userid = get_current_user_id(); $_gtm4wp_key = 'nickname'; $_gtm4wp_nickname = get_user_meta('nickname', true); $dataLayer["nickname"] = $_gtm4wp_nickname; }
But it returns ‘false”.
Forum: Themes and Templates
In reply to: Javascrip library not working in WP header, otherwise yesGot it. My javascript inclusion was in the wrong palce.
Ah, great. It was the “move javascript to footer” plugin. I use it for site speed. I’ll have to think of something else. Thanks a lot! I have another question, but I’ll ask it on a new topic.
Hi, sorry to revive an old topic, but I’m having the same issue at https://www.talesofyore.com. I’ve inserted the [yasr_visitor_votes] rating manually and it displays OK, but if I rate and refresh or go to another page, it doesn’t save it.