Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
NAP-wordpress
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marwa Sfari
NAP-wordpress
Commits
4ac0e8a6
Commit
4ac0e8a6
authored
Sep 19, 2017
by
imac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update]Fixed menu
parent
a174e96c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
67 deletions
+98
-67
main.css
wp-content/themes/nap/assets/css/main.css
+5
-2
main.js
wp-content/themes/nap/assets/js/main.js
+32
-11
functions.php
wp-content/themes/nap/functions.php
+23
-23
nav-list.php
wp-content/themes/nap/nav-list.php
+8
-8
archive-product.php
wp-content/themes/nap/woocommerce/archive-product.php
+30
-23
No files found.
wp-content/themes/nap/assets/css/main.css
View file @
4ac0e8a6
...
...
@@ -810,6 +810,9 @@ nav ul ul{
display
:
none
;
width
:
190px
;
}
.header
.nav-wrapper
ul
li
.current
ul
{
display
:
block
;
}
/*nav ul ul li:before{
content: "•";
padding-right: 5px;
...
...
@@ -1150,7 +1153,7 @@ aside.news-wrapper {
background-repeat
:
no-repeat
;
background-position
:
center
;
cursor
:
pointer
;
}
#slides
.element-slider
:last-child
.image
{
margin-bottom
:
0px
;
...
...
@@ -2682,7 +2685,7 @@ div.wpcf7-mail-sent-ok{
top
:
0
;
left
:
0
;
right
:
0
;
/*margin:0 -4px -5px -2px;*/
transition
:
all
.2s
ease
;
z-index
:
999999
9999999999
;
z-index
:
999999
;
}
#loading-container-subpage
{
display
:
none
;
...
...
wp-content/themes/nap/assets/js/main.js
View file @
4ac0e8a6
...
...
@@ -72,13 +72,13 @@ var initFunction=function(){
elemToScroll
=
$
(
document
).
find
(
".main"
);
scrollAnchor
(
'body'
,
true
);
}
elemToScroll
.
on
(
"scroll"
,
{
items
:
"ul.phototheque li .subcat a"
},
onScroll
);
elemToScroll
.
on
(
"scroll"
,
onScroll
);
document
.
getElementById
(
'load-page'
).
addEventListener
(
'scroll'
,
window
.
scrollAnimation
.
throttledEvent
,
false
);
$
(
document
).
find
(
'ul.
phototheque
'
).
on
(
'click'
,
' li.parent-cat>a'
,
function
(
e
){
$
(
document
).
find
(
'ul.
main-list-nav
'
).
on
(
'click'
,
' li.parent-cat>a'
,
function
(
e
){
var
windowWidth
=
$
(
window
).
width
();
e
.
preventDefault
();
e
.
stopPropagation
();
$
(
'.
phototheque
>li'
).
removeClass
(
'current'
);
$
(
'.
main-list-nav
>li'
).
removeClass
(
'current'
);
$
(
this
).
parent
().
addClass
(
'current'
);
//if (windowWidth < 860){
//$('.nav-phototeque .nav-content>ul>li').addClass('animated fadeOutLeft');
...
...
@@ -87,9 +87,9 @@ var initFunction=function(){
//$('.nav-phototeque .nav-content li.current ul').css('display','inline-block !important');
//.phototheque-content nav li
//}else{
$
(
'.
phototheque .subcat'
).
slideUp
(
'slow'
);
$
(
'.phototheque
.off .subcat'
).
slideUp
();
$
(
this
).
parent
().
find
(
'.subcat'
).
slideDown
(
'slow'
);
$
(
'.
main-list-nav .subcat'
).
stop
(
).
slideUp
(
'slow'
);
// $('.main-list-nav
.off .subcat').slideUp();
$
(
this
).
parent
().
find
(
'.subcat'
).
s
top
().
s
lideDown
(
'slow'
);
//}
...
...
@@ -97,7 +97,7 @@ var initFunction=function(){
setTimeout
(
function
(){
$
(
'.gallery-wrapper'
).
removeClass
(
'hidden-elem'
).
addClass
(
'animated visible-elem fadeInUp'
);
$
.
fn
.
responsive
();
},
50
)
},
100
);
}
function
appendLoading
()
{
$
(
'.load-page'
).
append
(
$
(
'#loading-container-subpage'
).
clone
());
...
...
@@ -110,11 +110,30 @@ var initFunction=function(){
e
.
preventDefault
();
var
link
=
$
(
this
).
attr
(
"href"
),
windowWidth
=
$
(
window
).
width
();
$
(
'.load-page'
).
parent
().
addClass
(
'active'
);
if
(
$
(
this
).
parent
().
parent
().
hasClass
(
'nav-page'
)){
$
(
document
).
find
(
'.right-container'
).
first
().
remove
();
$
(
'.load-page'
).
parent
().
css
({
'left'
:
$
(
'.nav-wrapper'
).
outerWidth
()
});
$
(
'.load-page'
).
css
(
'opacity'
,
1
);
$
(
document
).
find
(
'#loading-container-subpage'
).
css
({
'left'
:
$
(
'.nav-wrapper'
).
outerWidth
(),
'width'
:
'calc(100% - '
+
$
(
'.nav-wrapper'
).
outerWidth
()
+
'px)'
,
})
/**/
$
(
'nav ul li'
).
removeClass
(
'current'
).
addClass
(
'off'
);
$
(
this
).
parent
().
addClass
(
'current'
);
$
(
window
)
/**/
}
else
{
$
(
'.load-page'
).
parent
().
css
({
'left'
:
0
,
});
$
(
'.load-page'
).
parent
().
addClass
(
'active'
);
}
history
.
pushState
(
null
,
null
,
link
);
$
(
'.load-page'
).
load
(
link
,
function
(){
$
(
'.load-page'
).
load
(
link
,
{
'ajax'
:
1
},
function
(){
$
.
fn
.
loadPageContent
();
$
(
'#loading-container-subpage'
).
hide
();
});
if
(
windowWidth
<
860
){
$
(
".c-hamburger"
).
trigger
(
"click"
);
...
...
@@ -161,6 +180,7 @@ $('#file-p').on('change',function(e){
$
(
document
).
on
(
'click'
,
'.int-link'
,
function
(
e
){
e
.
preventDefault
();
$
(
'.load-page'
).
parent
().
removeClass
(
'active'
);
$
(
'.load-page'
).
parent
().
css
(
'left'
,
'100%'
);
history
.
pushState
(
null
,
null
,
$
(
this
).
find
(
'a'
).
attr
(
'href'
));
$
(
'html'
).
css
(
'overflow'
,
'auto'
);
tlProduct
.
reverse
();
...
...
@@ -634,6 +654,7 @@ function scrollAnchor(elemId, skipZero){
$
(
'.subcat'
).
each
(
function
(){
$
(
this
).
find
(
'a[href^="#"]'
).
on
(
'click'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
$
(
'a'
).
each
(
function
()
{
$
(
this
).
removeClass
(
'active'
);
})
...
...
@@ -720,7 +741,7 @@ $(document).ready(function(){
$
(
'.filter-bloc .list-color-filter li'
).
setColorToWhite
();
setTimeout
(
function
(){
onScrollCover
();
},
330
);
},
330
);
$
.
fn
.
open_nav
();
if
(
$
(
document
).
find
(
'#load-page'
).
children
().
length
){
...
...
wp-content/themes/nap/functions.php
View file @
4ac0e8a6
...
...
@@ -3,7 +3,7 @@
@
ini_set
(
'post_max_size'
,
'64M'
);
@
ini_set
(
'max_execution_time'
,
'300'
);
//Get Zones
//Get Zones
function
get_zones
(
$post_ID
=
157
)
{
if
(
get_field
(
'zones_commerciaux'
,
$post_ID
))
:
$i
=
0
;
...
...
@@ -88,7 +88,7 @@ function nap_change_wp_search_size($query) {
add_filter
(
'pre_get_posts'
,
'nap_change_wp_search_size'
);
//Custom logo
//Custom logo
function
nap_custom_loginlogo
()
{
echo
'<style type="text/css">
h1 a {background-image: url('
.
home_url
(
'wp-content/themes/nap/assets/images/logo.svg'
)
.
') !important;width:102px !important;background-size:100px !important;height:52px !important;background: #05162b;
...
...
@@ -310,7 +310,7 @@ function nap_menu() {
}
else
{
$nappe_sets
=
false
;
}
$menu
.=
'<li class ="parent-cat" data-page = "'
.
$category_id
.
'" data-img = "'
.
nap_category_image
(
$category_id
)
.
'"><a href="'
.
get_term_link
(
$cat
->
slug
,
'product_cat'
)
.
'">'
.
$cat
->
name
.
'</a>'
;
$menu
.=
'<li class ="parent-cat
to-slide
" data-page = "'
.
$category_id
.
'" data-img = "'
.
nap_category_image
(
$category_id
)
.
'"><a href="'
.
get_term_link
(
$cat
->
slug
,
'product_cat'
)
.
'">'
.
$cat
->
name
.
'</a>'
;
$args2
=
array
(
'taxonomy'
=>
$taxonomy
,
...
...
@@ -454,31 +454,31 @@ function nap_filter_attribute($id, $args, $options, $list_attr, $search) {
if
(
isset
(
$search
[
'sku'
])
&&
$search
[
'sku'
]
!=
''
)
{
$serach_by_ref
=
true
;
$_product
=
wc_get_product
(
$id
);
if
(
$_product
->
is_type
(
'simple'
)
){
$product_id
=
get_product_by_sku
(
$search
[
'sku'
]
);
if
(
$id
==
$product_id
[
0
]
->
post_id
)
$ref_product
=
1
;
}
elseif
(
$_product
->
is_type
(
'variable'
)
){
$variation
=
get_product_by_sku
(
$search
[
'sku'
]);
$variation_id
=
$variation
[
0
]
->
post_id
;
$variable_product
=
wc_get_product
(
$variation_id
);
if
(
$id
==
$variable_product
->
parent_id
)
$ref_product
=
1
;
}
// print $ref_product;
}
if
(
isset
(
$search
[
'pa_format'
])
&&
$search
[
'pa_format'
]
!=
''
)
{
$list_format
=
explode
(
","
,
$search
[
'pa_format'
]);
$intersect_format
=
array_intersect
(
$list_attr
[
'pa_format'
],
$list_format
);
...
...
@@ -495,14 +495,14 @@ function nap_filter_attribute($id, $args, $options, $list_attr, $search) {
if
(
isset
(
$search
[
'pa_univers'
])
&&
$search
[
'pa_univers'
]
!=
''
)
{
$list_univers
=
explode
(
","
,
$search
[
'pa_univers'
]);
}
if
(
$serach_by_ref
&&
$ref_product
)
{
echo
nap_get_item
(
$id
,
$args
,
'catalogue'
,
$options
);
return
;
}
if
(
(
!
$serach_by_ref
)
&&
(
(
$list_couleur
&&
!
empty
(
$intersect_couleur
))
||
empty
(
$list_couleur
)
)
&&
(
(
$list_format
&&
!
empty
(
$intersect_format
))
||
empty
(
$list_format
)
)
&&
...
...
@@ -512,7 +512,7 @@ function nap_filter_attribute($id, $args, $options, $list_attr, $search) {
echo
nap_get_item
(
$id
,
$args
,
'catalogue'
,
$options
);
}
}
function
nap_get_item
(
$post_ID
,
$args
=
null
,
$current_page
=
''
,
$options
=
null
,
$search
=
null
)
{
...
...
@@ -561,7 +561,7 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
}
$nap_article
=
'<article class = " visible row ">
<a href="#"></a>
<figure data-bg = "" class = "'
.
$size
.
' transition">
<figure data-bg = "" class = "'
.
$size
.
' transition">
<div class="abs-full article-bg transition"></div>'
;
$nap_article
.=
$nap_img
;
if
(
$current_page
==
'catalogue'
)
:
...
...
@@ -586,7 +586,7 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
$nap_article
.=
'</ul>'
;
endif
;
$nap_article
.=
'</figure>
<h3 class = "font-small" >'
.
$title_item
.
'</h3>
</article>'
;
...
...
@@ -713,7 +713,7 @@ function externe_referrer() {
$pageWasRefreshed
=
isset
(
$_SERVER
[
'HTTP_CACHE_CONTROL'
])
&&
(
$_SERVER
[
'HTTP_CACHE_CONTROL'
]
===
'max-age=0'
||
$_SERVER
[
'HTTP_CACHE_CONTROL'
]
==
'no-cache'
);
//The second parameter on print_r returns the result to a variable rather than displaying it
$RequestSignature
=
md5
(
$_SERVER
[
'REQUEST_URI'
]
.
$_SERVER
[
'QUERY_STRING'
]
.
print_r
(
$_POST
,
true
));
if
((
$pageWasRefreshed
||
empty
(
$url
)))
{
// && (from-site) //$_SESSION['LastRequest'] == $RequestSignature
if
((
$pageWasRefreshed
||
empty
(
$url
)))
{
// && (from-site) //$_SESSION['LastRequest'] == $RequestSignature
$ref
=
true
;
}
else
{
$ref
=
false
;
...
...
@@ -880,7 +880,7 @@ add_filter( 'wpseo_metadesc', function( $description )
global
$post
;
$terms
=
get_the_terms
(
$post
->
ID
,
'product_cat'
);
return
return
(
is_product
()
||
(
isset
(
$product
)
&&
$product
->
is_type
(
'variable'
))
)
?
$terms
[
1
]
->
description
:
$description
;
...
...
@@ -891,8 +891,8 @@ add_filter( 'wpseo_metadesc', function( $description )
function
get_product_by_sku
(
$sku
)
{
global
$wpdb
;
$post_item
=
$wpdb
->
get_results
(
"SELECT post_id FROM np_postmeta WHERE meta_key='_sku' AND meta_value="
.
$sku
.
" LIMIT 1"
);
...
...
wp-content/themes/nap/nav-list.php
View file @
4ac0e8a6
<div
class=
"nav-content font-big"
>
<?php
$arrow
=
'arrow-white'
;
$arrow
=
'arrow-white
nav-page
'
;
if
(
isset
(
$current_page
)
and
$current_page
==
'phototheque'
)
{
$arrow
=
'arrow-blue phototheque'
;
}
?>
<ul
class =
"
<?php
echo
$arrow
?>
"
>
<ul
class =
"
main-list-nav
<?php
echo
$arrow
?>
"
>
<?php
echo
nap_menu
();
?>
<li
data-page =
"uniqpaper"
data-img =
"
<?php
echo
nap_attachment_image
(
151
);
?>
"
><a
href=
"
<?php
echo
get_permalink
(
151
);
?>
"
>
Personnalisation
</a></li>
<li
class=
"to-slide"
data-page =
"uniqpaper"
data-img =
"
<?php
echo
nap_attachment_image
(
151
);
?>
"
><a
href=
"
<?php
echo
get_permalink
(
151
);
?>
"
>
Personnalisation
</a></li>
</ul>
<?php
if
(
!
(
isset
(
$current_page
)
and
$current_page
==
'phototheque'
))
{
?>
<ul
class=
"font-medium arrow-pink pink-list"
>
<li
data-page =
"stories"
data-img =
"
<?php
echo
nap_attachment_image
(
154
);
?>
"
><a
href=
"
<?php
echo
get_permalink
(
154
);
?>
"
>
Stories
</a></li>
<li
data-page =
"contact"
data-img =
"
<?php
echo
nap_attachment_image
(
157
);
?>
"
><a
href=
"
<?php
echo
get_permalink
(
157
);
?>
"
>
Contact
</a></li>
<li
class=
"to-slide"
data-page =
"stories"
data-img =
"
<?php
echo
nap_attachment_image
(
154
);
?>
"
><a
href=
"
<?php
echo
get_permalink
(
154
);
?>
"
>
Stories
</a></li>
<li
class=
"to-slide"
data-page =
"contact"
data-img =
"
<?php
echo
nap_attachment_image
(
157
);
?>
"
><a
href=
"
<?php
echo
get_permalink
(
157
);
?>
"
>
Contact
</a></li>
</ul>
<?php
}
?>
</div>
\ No newline at end of file
</div>
wp-content/themes/nap/woocommerce/archive-product.php
View file @
4ac0e8a6
...
...
@@ -20,7 +20,10 @@ if (!defined('ABSPATH')) {
exit
;
// Exit if accessed directly
}
$current_page
=
'catalogue'
;
get_header
();
if
(
!
(
isset
(
$_POST
[
'ajax'
])))
{
get_header
();
}
$product
;
$cate
=
get_queried_object
();
$cateID
=
$cate
->
term_id
;
...
...
@@ -33,8 +36,9 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
?>
<div
class=
"container clearfix"
id=
"catalogue"
data-page =
"
<?php
echo
$cateID
;
?>
"
>
<?php
if
(
!
(
isset
(
$_POST
[
'ajax'
])))
{
?>
<div
class=
"container-bg abs-full"
></div>
<?php
get_sidebar
()
?>
<?php
get_sidebar
();
}
?>
<div
class=
"header mobile-nav display--only-mobile blue-bg fixed"
>
<div
class=
"nav-wrapper blue-bg"
>
<ul></ul>
...
...
@@ -67,14 +71,14 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
$terms
=
nap_attribute_by_category
(
$cateID
,
$value
);
if
(
$value
==
'pa_couleur'
)
{
$all_terms
=
get_terms
(
$value
);
$colors_ids
=
array
();
foreach
(
$all_terms
as
$k
=>
$v
)
{
$colors_ids
[
$v
->
name
]
=
$v
->
term_id
;
}
$color_by_category
=
array_intersect
(
$colors_ids
,
$terms
);
}
if
(
!
empty
(
$terms
)
&&
!
is_wp_error
(
$terms
))
:
?>
...
...
@@ -82,9 +86,9 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
<ul
<?php
if
(
$value
==
'pa_couleur'
)
echo
'class = "list-color-filter clearfix"'
;
?>
id=
"
<?php
echo
$value
;
?>
"
>
<?php
$colors
=
array
();
foreach
(
$terms
as
$term
)
:
if
(
$value
==
'pa_couleur'
)
:
// var_dump($color_by_category);
$name_color
=
array_search
(
$term
,
$color_by_category
);
...
...
@@ -94,12 +98,12 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
$filter_format
=
nap_selected_filter
(
$_GET
[
'pa_format'
],
$term
);
$filter_matiere
=
nap_selected_filter
(
$_GET
[
'pa_matiere'
],
$term
);
$filter_univers
=
nap_selected_filter
(
$_GET
[
'pa_univers'
],
$term
);
?>
<li
class=
"
<?php
echo
$filter_format
.
' '
.
$filter_matiere
.
' '
.
$filter_univers
?>
"
>
<?php
echo
$term
;
?>
</li>
<?php
endif
;
endforeach
;
foreach
(
array_unique
(
$colors
)
as
$name
=>
$code
)
{
...
...
@@ -141,7 +145,7 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
<p>
<?php
echo
$value
->
description
;
?>
</p>
<?php
}
?>
</div>
</div>
</div>
<?php
endforeach
;
?>
...
...
@@ -150,7 +154,7 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
<div
class=
"panel panel-content list-animation"
>
<?php
if
(
$_GET
[
'pa_couleur'
]
!=
''
||
$_GET
[
'pa_format'
]
!=
''
||
$_GET
[
'pa_matiere'
]
!=
''
||
$_GET
[
'pa_univers'
]
!=
''
||
$_GET
[
'sku'
]
!=
''
)
:
?>
<span
class=
"search_result"
>
Résultat de votre recherche :
<span
class=
"search_notfound"
style=
"color:#ff6a5f"
></span></span>
<?php
endif
;
?>
<?php
foreach
(
$child_category
as
$key
=>
$value
)
:
?>
...
...
@@ -188,19 +192,19 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
$attribute_value
[
'pa_format'
]
=
get_the_terms
(
$id
,
'pa_format'
);
$attribute_value
[
'pa_matiere'
]
=
get_the_terms
(
$id
,
'pa_matiere'
);
$attribute_value
[
'pa_univers'
]
=
get_the_terms
(
$id
,
'pa_univers'
);
//var_dump($attribute_value['pa_format']);
if
(
is_array
(
$attribute_value
[
'pa_format'
]))
{
$list_formats
=
''
;
foreach
(
$attribute_value
[
'pa_format'
]
as
$key
=>
$value
)
{
$list_formats
.=
$value
->
name
.
','
;
}
$list_att
[
'pa_format'
]
=
explode
(
','
,
$list_formats
);
}
if
(
$_GET
)
{
if
(
is_array
(
$attribute_value
[
'pa_couleur'
]))
{
$list_couleurs
=
''
;
...
...
@@ -210,16 +214,16 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
}
$list_att
[
'pa_couleur'
]
=
explode
(
','
,
$list_couleurs
);
}
if
(
is_array
(
$attribute_value
[
'pa_format'
]))
{
$list_formats
=
''
;
foreach
(
$attribute_value
[
'pa_format'
]
as
$key
=>
$value
)
{
$list_formats
.=
$value
->
name
.
','
;
}
$list_att
[
'pa_format'
]
=
explode
(
','
,
$list_formats
);
}
if
(
is_array
(
$attribute_value
[
'pa_matiere'
]))
{
foreach
(
$attribute_value
[
'pa_matiere'
]
as
$key
=>
$value
)
{
$list_att
[
'pa_matiere'
]
=
$value
->
name
;
...
...
@@ -230,7 +234,7 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
$list_att
[
'pa_univers'
]
=
$value
->
name
;
}
}
nap_filter_attribute
(
$id
,
$args
,
$options
,
$list_att
,
$_GET
);
}
else
{
echo
nap_get_item
(
$id
,
$args
,
$current_page
,
$options
);
...
...
@@ -238,11 +242,14 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
endwhile
;
wp_reset_query
();
?>
</div>
</div>
</section>
<?php
endforeach
;
?>
</div>
</div>
</div>
</div>
<?php
get_footer
();
?>
<?php
if
(
!
(
isset
(
$_POST
[
'ajax'
])))
{
get_footer
();
}
?>
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