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) {
|
||||
|
||||
$all_posts = count($posts);
|
||||
$published_posts = count(array_filter($posts, "count_publish"));
|
||||
|
||||
echo <<<HTML
|
||||
<div style="border: 1px solid red; margin: 20px 20px 20px auto; padding: 0px 20px;">
|
||||
<p style="color: red;">
|
||||
<b>ATTENTION !</b>
|
||||
</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>
|
||||
<b>
|
||||
HTML;
|
||||
echo count($posts);
|
||||
echo "<span class='count_all_posts'>$all_posts</span>";
|
||||
echo "<span class='count_published_posts'>$published_posts</span>";
|
||||
echo '</b>';
|
||||
if (count($posts) == 1)
|
||||
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;">
|
||||
HTML;
|
||||
foreach ($posts as $post) {
|
||||
echo <<<HTML
|
||||
<li><b>
|
||||
HTML;
|
||||
if ($post->post_status === "publish") {
|
||||
echo <<<HTML
|
||||
<li class="jipf_post_publish"><b>
|
||||
HTML;
|
||||
}
|
||||
else {
|
||||
echo <<<HTML
|
||||
<li><b>
|
||||
HTML;
|
||||
}
|
||||
echo 'id: ';
|
||||
echo $post->ID;
|
||||
echo ' (status: ';
|
||||
@@ -119,15 +139,21 @@ function mp_show_list_posts_no_address($posts) {
|
||||
|
||||
function mp_show_list_posts_bad_categories($posts) {
|
||||
|
||||
$all_posts = count($posts);
|
||||
$published_posts = count(array_filter($posts, "count_publish"));
|
||||
|
||||
echo <<<HTML
|
||||
<div style="border: 1px solid red; margin: 20px 20px 20px auto; padding: 0px 20px;">
|
||||
<p style="color: red;">
|
||||
<b>ATTENTION !</b>
|
||||
</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>
|
||||
<b>
|
||||
HTML;
|
||||
echo count($posts);
|
||||
echo "<span class='count_all_posts'>$all_posts</span>";
|
||||
echo "<span class='count_published_posts'>$published_posts</span>";
|
||||
echo '</b>';
|
||||
if (count($posts) == 1)
|
||||
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;">
|
||||
HTML;
|
||||
foreach ($posts as $post) {
|
||||
echo <<<HTML
|
||||
<li><b>
|
||||
HTML;
|
||||
if ($post->post_status === "publish") {
|
||||
echo <<<HTML
|
||||
<li class="jipf_post_publish"><b>
|
||||
HTML;
|
||||
}
|
||||
else {
|
||||
echo <<<HTML
|
||||
<li><b>
|
||||
HTML;
|
||||
}
|
||||
echo 'id: ';
|
||||
echo $post->ID;
|
||||
echo ' (status: ';
|
||||
@@ -171,17 +204,24 @@ function mp_show_list_posts_bad_categories($posts) {
|
||||
|
||||
|
||||
|
||||
|
||||
function mp_show_list_posts_no_coordinates($posts) {
|
||||
|
||||
$all_posts = count($posts);
|
||||
$published_posts = count(array_filter($posts, "count_publish"));
|
||||
|
||||
echo <<<HTML
|
||||
<div style="border: 1px solid blue; margin: 20px 20px 20px auto; padding: 0px 20px;">
|
||||
<p style="color: blue;">
|
||||
<b>INFORMATION :</b>
|
||||
</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>
|
||||
<b>
|
||||
HTML;
|
||||
echo count($posts);
|
||||
echo "<span class='count_all_posts'>$all_posts</span>";
|
||||
echo "<span class='count_published_posts'>$published_posts</span>";
|
||||
echo '</b>';
|
||||
if (count($posts) == 1)
|
||||
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;">
|
||||
HTML;
|
||||
foreach ($posts as $post) {
|
||||
echo <<<HTML
|
||||
<li><b>
|
||||
HTML;
|
||||
if ($post->post_status === "publish") {
|
||||
echo <<<HTML
|
||||
<li class="jipf_post_publish"><b>
|
||||
HTML;
|
||||
}
|
||||
else {
|
||||
echo <<<HTML
|
||||
<li><b>
|
||||
HTML;
|
||||
}
|
||||
echo 'id: ';
|
||||
echo $post->ID;
|
||||
echo ' (status: ';
|
||||
@@ -311,6 +358,18 @@ function ljdp_map_plugin_content() {
|
||||
list-style-position: outside;
|
||||
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>
|
||||
<div>
|
||||
<h2>JIPF map plugin</h2>
|
||||
|
||||
Reference in New Issue
Block a user