Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
Laniakea
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Wordpress
Laniakea
Commits
4724305d
Commit
4724305d
authored
Apr 14, 2024
by
Simone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nuova features Google tag manager
parent
29731cbc
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
2 deletions
+47
-2
admin-configs.php
laniakea/core/admin/admin-configs.php
+5
-0
google.php
laniakea/core/admin/options/google.php
+5
-0
helper-functions.php
laniakea/core/helper-functions.php
+33
-0
tgmpa-activation.php
laniakea/core/tgmpa/tgmpa-activation.php
+2
-2
header.php
laniakea/header.php
+2
-0
No files found.
laniakea/core/admin/admin-configs.php
View file @
4724305d
...
@@ -136,6 +136,11 @@ function laniakea_tab_options()
...
@@ -136,6 +136,11 @@ function laniakea_tab_options()
'id'
=>
'iubenda'
,
'id'
=>
'iubenda'
,
'icon'
=>
'cookie'
,
'icon'
=>
'cookie'
,
'label'
=>
'Iubenda'
'label'
=>
'Iubenda'
],
[
'id'
=>
'Google'
,
'icon'
=>
'google fa-brands'
,
'label'
=>
'Google'
]
]
];
];
}
}
laniakea/core/admin/options/google.php
0 → 100644
View file @
4724305d
<div
class=
"field-group"
>
<h3>
ID contenitore
</h3>
<?php
laniakea_input
(
'google_tag_manager'
,
'text'
);
?>
</div>
\ No newline at end of file
laniakea/core/helper-functions.php
View file @
4724305d
...
@@ -26,6 +26,39 @@ function laniakea_compress_css($css = '')
...
@@ -26,6 +26,39 @@ function laniakea_compress_css($css = '')
return
$css
;
return
$css
;
}
}
function
laniakea_gtm
(
$position
)
{
if
(
empty
(
$position
))
return
;
$id
=
laniakea_option
(
'google_tag_manager'
);
if
(
!
empty
(
$id
))
{
if
(
$position
==
'head'
)
:
?>
<!-- Google Tag Manager -->
<script>
(
function
(
w
,
d
,
s
,
l
,
i
)
{
w
[
l
]
=
w
[
l
]
||
[];
w
[
l
].
push
({
'gtm.start'
:
new
Date
().
getTime
(),
event
:
'gtm.js'
});
var
f
=
d
.
getElementsByTagName
(
s
)[
0
],
j
=
d
.
createElement
(
s
),
dl
=
l
!=
'dataLayer'
?
'&l='
+
l
:
''
;
j
.
async
=
true
;
j
.
src
=
'https://www.googletagmanager.com/gtm.js?id='
+
i
+
dl
;
f
.
parentNode
.
insertBefore
(
j
,
f
);
})(
window
,
document
,
'script'
,
'dataLayer'
,
'
<?php
echo
$id
?>
'
);
</script>
<!-- End Google Tag Manager -->
<?php
elseif
(
$position
==
'body'
)
:
?>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe
src=
"https://www.googletagmanager.com/ns.html?id=
<?php
echo
$id
?>
"
height=
"0"
width=
"0"
style=
"display:none;visibility:hidden"
></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<?php
endif
;
}
}
function
laniakea_get_googleapi_font
()
function
laniakea_get_googleapi_font
()
{
{
...
...
laniakea/core/tgmpa/tgmpa-activation.php
View file @
4724305d
...
@@ -123,11 +123,11 @@ function laniakea_register_required_plugins()
...
@@ -123,11 +123,11 @@ function laniakea_register_required_plugins()
'name'
=>
'CookieYes'
,
'name'
=>
'CookieYes'
,
'slug'
=>
'cookie-law-info'
,
'slug'
=>
'cookie-law-info'
,
),
),
array
(
/*
array(
'name' => 'GTM4WP',
'name' => 'GTM4WP',
'slug' => 'duracelltomi-google-tag-manager',
'slug' => 'duracelltomi-google-tag-manager',
'required' => true
'required' => true
),
),
*/
array
(
array
(
'name'
=>
'Meta pixel for WordPress'
,
'name'
=>
'Meta pixel for WordPress'
,
'slug'
=>
'official-facebook-pixel'
,
'slug'
=>
'official-facebook-pixel'
,
...
...
laniakea/header.php
View file @
4724305d
...
@@ -18,6 +18,7 @@ $show_header_inverted = $slider || $laniakea_transparent_header;
...
@@ -18,6 +18,7 @@ $show_header_inverted = $slider || $laniakea_transparent_header;
<link
rel=
"pingback"
href=
"
<?php
esc_url
(
bloginfo
(
'pingback_url'
));
?>
"
/>
<link
rel=
"pingback"
href=
"
<?php
esc_url
(
bloginfo
(
'pingback_url'
));
?>
"
/>
<?php
laniakea_get_googleapi_font
();
?>
<?php
laniakea_get_googleapi_font
();
?>
<?php
laniakea_gtm
(
'head'
);
?>
<?php
wp_head
();
?>
<?php
wp_head
();
?>
<?php
<?php
...
@@ -30,6 +31,7 @@ $show_header_inverted = $slider || $laniakea_transparent_header;
...
@@ -30,6 +31,7 @@ $show_header_inverted = $slider || $laniakea_transparent_header;
<body
<?php
body_class
();
?>
>
<body
<?php
body_class
();
?>
>
<?php
wp_body_open
();
?>
<?php
wp_body_open
();
?>
<?php
laniakea_gtm
(
'body'
);
?>
<div
id=
"wrapper"
>
<div
id=
"wrapper"
>
<header
id=
"main-header"
<?php
if
(
!
empty
(
$show_header_inverted
))
echo
'class="inverted"'
?>
>
<header
id=
"main-header"
<?php
if
(
!
empty
(
$show_header_inverted
))
echo
'class="inverted"'
?>
>
<?php
if
(
laniakea_option
(
'show_preheader'
)
==
1
)
get_template_part
(
'templates/pre'
,
'header'
);
?>
<?php
if
(
laniakea_option
(
'show_preheader'
)
==
1
)
get_template_part
(
'templates/pre'
,
'header'
);
?>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment