Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Adullact
Theme-WordPress-Adullact-org
Commits
7d2aef47
Commit
7d2aef47
authored
Feb 05, 2020
by
N. Peraldi
Browse files
doc: add phpdoc & improve some functions location
parent
871d1fd7
Changes
2
Hide whitespace changes
Inline
Side-by-side
category-membres.php
View file @
7d2aef47
...
...
@@ -7,6 +7,92 @@ $order = "asc";
$link
=
"http://"
.
$_SERVER
[
'SERVER_NAME'
]
.
$_SERVER
[
"REDIRECT_URL"
];
$pagination
=
true
;
/**On affiche les boutons pour trier les membres en fonction du type de collectivité
* @param string $category_to_select
*/
function
childrens_of_member_category
(
$category_to_select
)
{
$member_category_object
=
get_category_by_slug
(
"membres"
);
$id
=
$member_category_object
->
cat_ID
;
$server_link
=
$_SERVER
[
"SERVER_NAME"
];
$link_Category
=
"http://"
.
$server_link
.
"/category/"
;
$current_category
=
$category_to_select
;
dump_debug
(
$_SERVER
);
echo_debug
(
"
\n
----------------------
\n
"
);
dump_debug
(
$member_category_object
);
$childrens
=
get_term_children
(
$id
,
"category"
);
//contiendra les id de tous les enfants de adhérent
if
(
$current_category
==
"membres"
||
$current_category
==
""
)
{
echo
" <li class='adullact-sort-button adullact-selected'><a href='"
.
$link_Category
.
"membres/'>Tout</a></li>"
;
}
else
{
echo
" <li class='adullact-sort-button'><a href='"
.
$link_Category
.
"membres/'>Tout</a></li>"
;
}
foreach
(
$childrens
as
$c
)
{
$temp_category
=
get_category
(
$c
);
//objet contenant les infos de la catégorie enfant
$my_link
=
"<li class='adullact-sort-button"
;
if
(
$temp_category
->
slug
==
$category_to_select
)
{
//si on est en train d'afficher la catégorie sélectionnée
$my_link
.
=
" adullact-selected"
;
}
else
{
echo_debug
(
$temp_category
->
slug
.
"=/="
.
$category_to_select
);
}
$my_link
.
=
"'><a href =
\"
http://"
.
$server_link
.
"/category/"
;
$my_link
.
=
$temp_category
->
slug
;
$my_link
.
=
"
\"
"
;
$my_link
.
=
"
\"
>"
;
$my_link
.
=
$temp_category
->
name
;
$my_link
.
=
"</a></li>"
;
echo
$my_link
;
}
}
/**on génère les boutons pour trier les membres par ordre croissant / décroissant
* @param string $order
* @param string $page
* @param string $link
*/
function
sort_page
(
$order
,
$page
,
$link
)
{
$for_asc_link
=
$link
.
"?page="
.
$page
.
"&order=asc"
;
$for_desc_link
=
$link
.
"?page="
.
$page
.
"&order=desc"
;
if
(
$order
==
"desc"
)
{
?>
<li
class=
"adullact-sort-button"
>
<a
href=
"
<?php
echo
$for_asc_link
;
?>
"
>
Croissant
</a>
</li>
<li
class=
"adullact-sort-button adullact-selected"
>
<a
href=
"
<?php
echo
$for_desc_link
;
?>
"
>
Décroissant
</a>
</li>
<?php
}
else
{
?>
<li
class=
"adullact-sort-button adullact-selected"
>
<a
href=
"
<?php
echo
$for_asc_link
;
?>
"
>
Croissant
</a>
</li>
<li
class=
"adullact-sort-button"
>
<a
href=
"
<?php
echo
$for_desc_link
;
?>
"
>
Décroissant
</a>
</li>
<?php
}
}
//on vérifie bien le numéro de la page
if
(
isset
(
$_GET
[
"page"
]))
{
if
(
is_numeric
(
$_GET
[
"page"
]))
{
...
...
functions.php
View file @
7d2aef47
...
...
@@ -41,89 +41,19 @@ function dump_debug($list)
}
}
function
childrens_of_member_category
(
$category_to_select
)
{
//cette fonction affiche la liste des catégories enfants de la catégorie mère Adhérent
$member_category_object
=
get_category_by_slug
(
"membres"
);
$id
=
$member_category_object
->
cat_ID
;
$server_link
=
$_SERVER
[
"SERVER_NAME"
];
$link_Category
=
"http://"
.
$server_link
.
"/category/"
;
$current_category
=
$category_to_select
;
dump_debug
(
$_SERVER
);
echo_debug
(
"
\n
----------------------
\n
"
);
dump_debug
(
$member_category_object
);
//SERVER_NAME
$childrens
=
get_term_children
(
$id
,
"category"
);
//contiendra les id de tous les enfants de adhérent
if
(
$current_category
==
"membres"
||
$current_category
==
""
)
{
echo
" <li class='adullact-sort-button adullact-selected'><a href='"
.
$link_Category
.
"membres/'>Tout</a></li>"
;
}
else
{
echo
" <li class='adullact-sort-button'><a href='"
.
$link_Category
.
"membres/'>Tout</a></li>"
;
}
foreach
(
$childrens
as
$c
)
{
$temp_category
=
get_category
(
$c
);
//objet contenant les infos de la catégorie enfant
$my_link
=
"<li class='adullact-sort-button"
;
if
(
$temp_category
->
slug
==
$category_to_select
)
{
//si on est en train d'afficher la catégorie sélectionnée
$my_link
.
=
" adullact-selected"
;
}
else
{
echo_debug
(
$temp_category
->
slug
.
"=/="
.
$category_to_select
);
}
$my_link
.
=
"'><a href =
\"
http://"
.
$server_link
.
"/category/"
;
$my_link
.
=
$temp_category
->
slug
;
$my_link
.
=
"
\"
"
;
$my_link
.
=
"
\"
>"
;
$my_link
.
=
$temp_category
->
name
;
$my_link
.
=
"</a></li>"
;
echo
$my_link
;
}
}
function
sort_page
(
$order
,
$page
,
$link
)
{
$for_asc_link
=
$link
.
"?page="
.
$page
.
"&order=asc"
;
$for_desc_link
=
$link
.
"?page="
.
$page
.
"&order=desc"
;
if
(
$order
==
"desc"
)
{
?>
<li
class=
"adullact-sort-button"
>
<a
href=
"
<?php
echo
$for_asc_link
;
?>
"
>
Croissant
</a>
</li>
<li
class=
"adullact-sort-button adullact-selected"
>
<a
href=
"
<?php
echo
$for_desc_link
;
?>
"
>
Décroissant
</a>
</li>
<?php
}
else
{
?>
<li
class=
"adullact-sort-button adullact-selected"
>
<a
href=
"
<?php
echo
$for_asc_link
;
?>
"
>
Croissant
</a>
</li>
<li
class=
"adullact-sort-button"
>
<a
href=
"
<?php
echo
$for_desc_link
;
?>
"
>
Décroissant
</a>
</li>
<?php
}
}
/**Génère un effet de type parallax avec une image personnalisée.
* @param string $url
*/
function
add_parallax
(
$url
)
{
//génère un "style=" pour l'ajout d'un effet parallax
echo
"style=
\"
background: url('"
.
$url
.
"') fixed;width:100%
\"
"
;
}
\ No newline at end of file
}
/**on supprime du texte inutile généré sur certaines pages
* @return string
*/
function
wpc_remove_archive_title_prefix
()
{
return
""
;
}
add_filter
(
'get_the_archive_title'
,
'wpc_remove_archive_title_prefix'
);
\ No newline at end of file
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