-
Notifications
You must be signed in to change notification settings - Fork 12
/
prepend breadcrumb to store page breadcrumbs.html
61 lines (32 loc) · 1.36 KB
/
prepend breadcrumb to store page breadcrumbs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<script>
$( ( ) => {
/*
begin prepend breadcrumb to store page breadcrumbs
License : < https://tinyurl.com/s872fb68 >
Version : 0.1d0
SS Version : 7.1
Dependencies : jQuery
By : Thomas Creedon < http://www.tomsWeb.consulting/ >
*/
const text = '[enter link text here between single quotes]';
/*
copy value needed for urlSlug below from Page Settings > General >
URL SLUG field. you only need exactly what can be selected from the
field
*/
const urlSlug = '[enter page url slug here between single quotes]';
// do not change anything below, there be the borg here
const selector = '.ProductItem-nav-breadcrumb';
if ( ! $( selector ).length ) return;
$( '.ProductItem-nav-breadcrumb-link:first, ' +
'.ProductItem-nav-breadcrumb-link:first ~ ' +
'.ProductItem-nav-breadcrumb-separator' )
.clone ( )
.first ( )
.attr ( 'href', '/' + urlSlug )
.text ( text )
.end ( )
.prependTo ( selector );
// end prepend breadcrumb to store page breadcrumbs
} );
</script>