added option to show only published articles in menu
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -72,17 +72,30 @@ function mp_bad_categories($posts_list) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function count_publish($arr_posts) {
|
||||||
|
return($arr_posts->post_status === "publish");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function mp_show_list_posts_no_address($posts) {
|
function mp_show_list_posts_no_address($posts) {
|
||||||
|
|
||||||
|
$all_posts = count($posts);
|
||||||
|
$published_posts = count(array_filter($posts, "count_publish"));
|
||||||
|
|
||||||
echo <<<HTML
|
echo <<<HTML
|
||||||
<div style="border: 1px solid red; margin: 20px 20px 20px auto; padding: 0px 20px;">
|
<div style="border: 1px solid red; margin: 20px 20px 20px auto; padding: 0px 20px;">
|
||||||
<p style="color: red;">
|
<p style="color: red;">
|
||||||
<b>ATTENTION !</b>
|
<b>ATTENTION !</b>
|
||||||
</p>
|
</p>
|
||||||
|
<input type="checkbox" class="hide_not_published" id="posts_no_address_published">
|
||||||
|
<label for="posts_no_address_published">afficher uniquement les articles publiés</label>
|
||||||
<p>
|
<p>
|
||||||
<b>
|
<b>
|
||||||
HTML;
|
HTML;
|
||||||
echo count($posts);
|
echo "<span class='count_all_posts'>$all_posts</span>";
|
||||||
|
echo "<span class='count_published_posts'>$published_posts</span>";
|
||||||
echo '</b>';
|
echo '</b>';
|
||||||
if (count($posts) == 1)
|
if (count($posts) == 1)
|
||||||
echo " article n'a pas d'adresse :";
|
echo " article n'a pas d'adresse :";
|
||||||
@@ -93,9 +106,16 @@ function mp_show_list_posts_no_address($posts) {
|
|||||||
<ul style="list-style: square inside;">
|
<ul style="list-style: square inside;">
|
||||||
HTML;
|
HTML;
|
||||||
foreach ($posts as $post) {
|
foreach ($posts as $post) {
|
||||||
echo <<<HTML
|
if ($post->post_status === "publish") {
|
||||||
<li><b>
|
echo <<<HTML
|
||||||
HTML;
|
<li class="jipf_post_publish"><b>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo <<<HTML
|
||||||
|
<li><b>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
echo 'id: ';
|
echo 'id: ';
|
||||||
echo $post->ID;
|
echo $post->ID;
|
||||||
echo ' (status: ';
|
echo ' (status: ';
|
||||||
@@ -119,15 +139,21 @@ function mp_show_list_posts_no_address($posts) {
|
|||||||
|
|
||||||
function mp_show_list_posts_bad_categories($posts) {
|
function mp_show_list_posts_bad_categories($posts) {
|
||||||
|
|
||||||
|
$all_posts = count($posts);
|
||||||
|
$published_posts = count(array_filter($posts, "count_publish"));
|
||||||
|
|
||||||
echo <<<HTML
|
echo <<<HTML
|
||||||
<div style="border: 1px solid red; margin: 20px 20px 20px auto; padding: 0px 20px;">
|
<div style="border: 1px solid red; margin: 20px 20px 20px auto; padding: 0px 20px;">
|
||||||
<p style="color: red;">
|
<p style="color: red;">
|
||||||
<b>ATTENTION !</b>
|
<b>ATTENTION !</b>
|
||||||
</p>
|
</p>
|
||||||
|
<input type="checkbox" class="hide_not_published" id="posts_bad_categories_published">
|
||||||
|
<label for="posts_bad_categories_published">afficher uniquement les articles publiés</label>
|
||||||
<p>
|
<p>
|
||||||
<b>
|
<b>
|
||||||
HTML;
|
HTML;
|
||||||
echo count($posts);
|
echo "<span class='count_all_posts'>$all_posts</span>";
|
||||||
|
echo "<span class='count_published_posts'>$published_posts</span>";
|
||||||
echo '</b>';
|
echo '</b>';
|
||||||
if (count($posts) == 1)
|
if (count($posts) == 1)
|
||||||
echo " article à sa catégorie mal formatée :";
|
echo " article à sa catégorie mal formatée :";
|
||||||
@@ -138,9 +164,16 @@ function mp_show_list_posts_bad_categories($posts) {
|
|||||||
<ul style="list-style: square inside;">
|
<ul style="list-style: square inside;">
|
||||||
HTML;
|
HTML;
|
||||||
foreach ($posts as $post) {
|
foreach ($posts as $post) {
|
||||||
echo <<<HTML
|
if ($post->post_status === "publish") {
|
||||||
<li><b>
|
echo <<<HTML
|
||||||
HTML;
|
<li class="jipf_post_publish"><b>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo <<<HTML
|
||||||
|
<li><b>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
echo 'id: ';
|
echo 'id: ';
|
||||||
echo $post->ID;
|
echo $post->ID;
|
||||||
echo ' (status: ';
|
echo ' (status: ';
|
||||||
@@ -171,17 +204,24 @@ function mp_show_list_posts_bad_categories($posts) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function mp_show_list_posts_no_coordinates($posts) {
|
function mp_show_list_posts_no_coordinates($posts) {
|
||||||
|
|
||||||
|
$all_posts = count($posts);
|
||||||
|
$published_posts = count(array_filter($posts, "count_publish"));
|
||||||
|
|
||||||
echo <<<HTML
|
echo <<<HTML
|
||||||
<div style="border: 1px solid blue; margin: 20px 20px 20px auto; padding: 0px 20px;">
|
<div style="border: 1px solid blue; margin: 20px 20px 20px auto; padding: 0px 20px;">
|
||||||
<p style="color: blue;">
|
<p style="color: blue;">
|
||||||
<b>INFORMATION :</b>
|
<b>INFORMATION :</b>
|
||||||
</p>
|
</p>
|
||||||
|
<input type="checkbox" class="hide_not_published" id="posts_no_coordinates_published">
|
||||||
|
<label for="posts_no_coordinates_published">afficher uniquement les articles publiés</label>
|
||||||
<p>
|
<p>
|
||||||
<b>
|
<b>
|
||||||
HTML;
|
HTML;
|
||||||
echo count($posts);
|
echo "<span class='count_all_posts'>$all_posts</span>";
|
||||||
|
echo "<span class='count_published_posts'>$published_posts</span>";
|
||||||
echo '</b>';
|
echo '</b>';
|
||||||
if (count($posts) == 1)
|
if (count($posts) == 1)
|
||||||
echo " article n'a pas de coordonnees :";
|
echo " article n'a pas de coordonnees :";
|
||||||
@@ -192,9 +232,16 @@ function mp_show_list_posts_no_coordinates($posts) {
|
|||||||
<ul style="list-style: square inside;">
|
<ul style="list-style: square inside;">
|
||||||
HTML;
|
HTML;
|
||||||
foreach ($posts as $post) {
|
foreach ($posts as $post) {
|
||||||
echo <<<HTML
|
if ($post->post_status === "publish") {
|
||||||
<li><b>
|
echo <<<HTML
|
||||||
HTML;
|
<li class="jipf_post_publish"><b>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo <<<HTML
|
||||||
|
<li><b>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
echo 'id: ';
|
echo 'id: ';
|
||||||
echo $post->ID;
|
echo $post->ID;
|
||||||
echo ' (status: ';
|
echo ' (status: ';
|
||||||
@@ -311,6 +358,18 @@ function ljdp_map_plugin_content() {
|
|||||||
list-style-position: outside;
|
list-style-position: outside;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
input.hide_not_published:checked ~ ul li:not(.jipf_post_publish) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.count_published_posts {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
input.hide_not_published:checked ~ p .count_all_posts {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
input.hide_not_published:checked ~ p .count_published_posts {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<div>
|
<div>
|
||||||
<h2>JIPF map plugin</h2>
|
<h2>JIPF map plugin</h2>
|
||||||
|
|||||||
Reference in New Issue
Block a user