Compare commits
2 Commits
1e0c200466
...
0a3721a82a
| Author | SHA1 | Date | |
|---|---|---|---|
| 0a3721a82a | |||
| 90ed4c674b |
|
|
@ -50,7 +50,7 @@ function custom_post_status()
|
|||
{
|
||||
register_post_status('offline', array(
|
||||
'label' => __('Hors ligne', 'metiers-patrimoine-theme'),
|
||||
'public' => true,
|
||||
'public' => false,
|
||||
'exclude_from_search' => false,
|
||||
'show_in_admin_all_list' => true,
|
||||
'show_in_admin_status_list' => true,
|
||||
|
|
@ -59,7 +59,15 @@ function custom_post_status()
|
|||
}
|
||||
add_action('init', 'custom_post_status');
|
||||
|
||||
|
||||
// Permettre aux utilisateurs connectés de voir les posts 'offline'
|
||||
function allow_logged_in_users_to_view_offline_posts($query)
|
||||
{
|
||||
if (!is_admin() && $query->is_main_query() && is_user_logged_in()) {
|
||||
$query->set('post_status', array('publish', 'offline'));
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
add_filter('pre_get_posts', 'allow_logged_in_users_to_view_offline_posts');
|
||||
|
||||
function add_to_post_status_dropdown()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ get_header();
|
|||
?>
|
||||
|
||||
<?php
|
||||
get_header();
|
||||
$pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
|
||||
?>
|
||||
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user