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
349939a3
Commit
349939a3
authored
Aug 03, 2017
by
imac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Merge]
parent
1bc53557
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
27 deletions
+63
-27
functions.php
wp-content/themes/nap/functions.php
+63
-27
No files found.
wp-content/themes/nap/functions.php
View file @
349939a3
...
@@ -23,8 +23,8 @@ function get_zones($post_ID = 157) {
...
@@ -23,8 +23,8 @@ function get_zones($post_ID = 157) {
}
}
function
nap_enqueue_scripts
()
{
function
nap_enqueue_scripts
()
{
// Enqueue jQuery UI and autocomplete
// Enqueue jQuery UI and autocomplete
wp_enqueue_script
(
'jquery-ui-core'
);
wp_enqueue_script
(
'jquery-ui-core'
);
wp_enqueue_script
(
'jquery-ui-autocomplete'
);
wp_enqueue_script
(
'jquery-ui-autocomplete'
);
}
}
add_action
(
'wp_enqueue_scripts'
,
'nap_enqueue_scripts'
);
add_action
(
'wp_enqueue_scripts'
,
'nap_enqueue_scripts'
);
...
@@ -194,9 +194,9 @@ function nap_variation_settings_fields($loop, $variation_data, $variation) {
...
@@ -194,9 +194,9 @@ function nap_variation_settings_fields($loop, $variation_data, $variation) {
)
)
);
?>
);
?>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
jQuery
(
document
).
ready
(
function
(){
jQuery
(
document
).
ready
(
function
(){
var
posts
=
<?php
echo
json_encode
(
$option
);
?>
;
var
posts
=
<?php
echo
json_encode
(
$option
);
?>
;
var
data
=
[];
var
data
=
[];
jQuery
.
each
(
posts
,
function
(
index
,
value
)
{
jQuery
.
each
(
posts
,
function
(
index
,
value
)
{
...
@@ -205,18 +205,18 @@ function nap_variation_settings_fields($loop, $variation_data, $variation) {
...
@@ -205,18 +205,18 @@ function nap_variation_settings_fields($loop, $variation_data, $variation) {
jQuery
(
'input[name="fiche_var_auto_
<?php
echo
$variation
->
ID
?>
"]'
).
click
(
function
()
{
jQuery
(
'input[name="fiche_var_auto_
<?php
echo
$variation
->
ID
?>
"]'
).
click
(
function
()
{
jQuery
(
this
).
val
(
''
);
jQuery
(
this
).
val
(
''
);
});
});
jQuery
(
'input[name="fiche_var_auto_
<?php
echo
$variation
->
ID
?>
"]'
).
autocomplete
({
jQuery
(
'input[name="fiche_var_auto_
<?php
echo
$variation
->
ID
?>
"]'
).
autocomplete
({
source
:
data
,
source
:
data
,
minLength
:
1
,
minLength
:
1
,
select
:
function
(
event
,
ui
)
{
select
:
function
(
event
,
ui
)
{
event
.
preventDefault
();
event
.
preventDefault
();
jQuery
(
this
).
val
(
ui
.
item
.
label
);
jQuery
(
this
).
val
(
ui
.
item
.
label
);
jQuery
(
"#_var_fiche_
<?php
echo
$variation
->
ID
?>
"
).
val
(
ui
.
item
.
value
);
jQuery
(
"#_var_fiche_
<?php
echo
$variation
->
ID
?>
"
).
val
(
ui
.
item
.
value
);
}
}
});
});
});
});
</script>
</script>
<?php
<?php
woocommerce_wp_hidden_input
(
woocommerce_wp_hidden_input
(
...
@@ -290,7 +290,7 @@ function nap_menu() {
...
@@ -290,7 +290,7 @@ function nap_menu() {
$menu
=
""
;
$menu
=
""
;
$taxonomy
=
'product_cat'
;
$taxonomy
=
'product_cat'
;
$orderby
=
'
title
'
;
$orderby
=
'
id
'
;
$show_count
=
0
;
$show_count
=
0
;
$pad_counts
=
0
;
$pad_counts
=
0
;
$hierarchical
=
1
;
$hierarchical
=
1
;
...
@@ -316,7 +316,7 @@ function nap_menu() {
...
@@ -316,7 +316,7 @@ function nap_menu() {
'taxonomy'
=>
$taxonomy
,
'taxonomy'
=>
$taxonomy
,
'child_of'
=>
0
,
'child_of'
=>
0
,
'parent'
=>
$category_id
,
'parent'
=>
$category_id
,
'orderby'
=>
$orderby
,
'orderby'
=>
'title'
,
'show_count'
=>
$show_count
,
'show_count'
=>
$show_count
,
'pad_counts'
=>
$pad_counts
,
'pad_counts'
=>
$pad_counts
,
'hierarchical'
=>
$hierarchical
,
'hierarchical'
=>
$hierarchical
,
...
@@ -537,9 +537,9 @@ function nap_general_product_data_custom_field($post_id) {
...
@@ -537,9 +537,9 @@ function nap_general_product_data_custom_field($post_id) {
)
)
);
?>
);
?>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
jQuery
(
document
).
ready
(
function
(){
jQuery
(
document
).
ready
(
function
(){
var
posts
=
<?php
echo
json_encode
(
$option
);
?>
;
var
posts
=
<?php
echo
json_encode
(
$option
);
?>
;
var
data
=
[];
var
data
=
[];
jQuery
.
each
(
posts
,
function
(
index
,
value
)
{
jQuery
.
each
(
posts
,
function
(
index
,
value
)
{
...
@@ -548,18 +548,18 @@ function nap_general_product_data_custom_field($post_id) {
...
@@ -548,18 +548,18 @@ function nap_general_product_data_custom_field($post_id) {
jQuery
(
'input[name="fiche_simple_auto"]'
).
click
(
function
()
{
jQuery
(
'input[name="fiche_simple_auto"]'
).
click
(
function
()
{
jQuery
(
this
).
val
(
''
);
jQuery
(
this
).
val
(
''
);
});
});
jQuery
(
'input[name="fiche_simple_auto"]'
).
autocomplete
({
jQuery
(
'input[name="fiche_simple_auto"]'
).
autocomplete
({
source
:
data
,
source
:
data
,
minLength
:
1
,
minLength
:
1
,
select
:
function
(
event
,
ui
)
{
select
:
function
(
event
,
ui
)
{
event
.
preventDefault
();
event
.
preventDefault
();
jQuery
(
this
).
val
(
ui
.
item
.
label
);
jQuery
(
this
).
val
(
ui
.
item
.
label
);
jQuery
(
"#_fiche_simple"
).
val
(
ui
.
item
.
value
);
jQuery
(
"#_fiche_simple"
).
val
(
ui
.
item
.
value
);
}
}
});
});
});
});
</script>
</script>
<?php
<?php
woocommerce_wp_hidden_input
(
woocommerce_wp_hidden_input
(
...
@@ -597,5 +597,41 @@ function nap_save_general_proddata_custom_field( $post_id ) {
...
@@ -597,5 +597,41 @@ function nap_save_general_proddata_custom_field( $post_id ) {
update_post_meta
(
$post_id
,
'_itf14_simple'
,
esc_attr
(
$text_itf14
)
);
update_post_meta
(
$post_id
,
'_itf14_simple'
,
esc_attr
(
$text_itf14
)
);
}
}
}
}
//MS 2017-08-02 : Get referrer
function
externe_referrer
(
)
{
$url
=
$_SERVER
[
'HTTP_REFERER'
];
$postid
=
url_to_postid
(
$url
);
$ref
=
false
;
$uri
=
$_SERVER
[
'HTTP_HOST'
]
.
$_SERVER
[
'REQUEST_URI'
];
$pageWasRefreshed
=
isset
(
$_SERVER
[
'HTTP_CACHE_CONTROL'
])
&&
$_SERVER
[
'HTTP_CACHE_CONTROL'
]
===
'max-age=0'
;
if
(
$pageWasRefreshed
)
{
$postid
=
-
1
;
}
else
{
$postid
=
0
;
}
if
(
$postid
<
0
){
$ref
=
true
;
}
echo
$postid
;
if
(
$pageWasRefreshed
)
{
$postid
=
-
1
;
}
global
$post
;
$terms
=
get_the_terms
(
$post
->
ID
,
'product_cat'
);
foreach
(
$terms
as
$term
)
{
$product_cat_id
=
$term
->
term_id
;
echo
'prod_eeeeee === '
.
$product_cat_id
;
break
;
return
$ref
;
}
}
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