@charset "UTF-8";

/*!
Theme Name: Cocoon Child
Description: Cocoon専用の子テーマ
Theme URI: https://wp-cocoon.com/
Author: わいひら
Author URI: https://nelog.jp/
Template:   cocoon-master
Version:    1.1.3
*/

/************************************
** 子テーマ用のスタイルを書く
************************************/
/*必要ならばここにコードを書く*/
// 投稿公開から一定時間後に非公開にする（例：1時間）
function auto_unpublish_old_posts() {
  $args = array(
    'post_type'      => 'post',
    'post_status'    => 'publish',
    'posts_per_page' => -1,
    'date_query'     => array(
      array(
        'column' => 'post_date',
        'before' => '1 hours ago' // ← ここを変更で時間調整
      ),
    ),
  );

  $query = new WP_Query($args);

  foreach ($query->posts as $post) {
    // ステータスを「非公開（private）」または「下書き（draft）」に変更
    wp_update_post(array(
      'ID' => $post->ID,
      'post_status' => 'private' // または 'draft'
    ));
  }
}
add_action('auto_unpublish_event', 'auto_unpublish_old_posts');

// 毎時間のWP-Cronイベントをスケジュール
function schedule_auto_unpublish() {
  if (!wp_next_scheduled('auto_unpublish_event')) {
    wp_schedule_event(time(), 'hourly', 'auto_unpublish_event');
  }
}
add_action('wp', 'schedule_auto_unpublish');

/*スマホのサイドバーメニューを左から右に表示*/
.sidebar-menu-content {
  -webkit-transform: translateX(-105%);
  transform: translateX(-105%);
  right: auto;
  left: 0;
} 
/*ボックスメニューの色変更*/
.box-menu-icon{
  color: #ff7f50;
}

.box-menu:hover {
    box-shadow: inset 2px 2px 0 0 
#ff7f50,2px 2px 0 0 #ff7f50,2px 0 0 0 #ff7f50,0 2px 0 0
    #ff7f50;
} 

//パスワードページ本文上シェアボタン
function is_sns_single_top_share_buttons_visible() {
  global $post;
  if (empty($post->post_password)) {
    return get_theme_option(OP_SNS_SINGLE_TOP_SHARE_BUTTONS_VISIBLE, 1);
  }
}

//パスワードページ本文下シェアボタン
function is_sns_single_bottom_share_buttons_visible() {
  global $post;
  if (empty($post->post_password)) {
    return get_theme_option(OP_SNS_SINGLE_BOTTOM_SHARE_BUTTONS_VISIBLE, 1);
  }
}

// パスワードページ本文下フォローボタン
function is_sns_follow_buttons_visible() {
  global $post;
  if (empty($post->post_password)) {
    return get_theme_option(OP_SNS_FOLLOW_BUTTONS_VISIBLE, 1);
  }
}
/************************************
** レスポンシブデザイン用のメディアクエリ
************************************/
/*1023px以下*/
@media screen and (max-width: 1023px){
  /*必要ならばここにコードを書く*/
}

/*834px以下*/
@media screen and (max-width: 834px){
  /*必要ならばここにコードを書く*/
}

/*480px以下*/
@media screen and (max-width: 480px){
  /*必要ならばここにコードを書く*/
}
