在籍キャスト一覧ページに、出勤時間を表示する

在籍キャスト一覧ページにも、出勤時間を表示するには、以下のように変更してください。

 

archive-cast.php 62行目付近を下記のように変更

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$schData = CP5_Schedule::get_scheduleByTime( $cp5_startTime, $cp5_endTime, '', '', false );
$schData = CP5_Schedule::get_scheduleByTime( $cp5_startTime, $cp5_endTime, '', '', false );
$schData = CP5_Schedule::get_scheduleByTime( $cp5_startTime, $cp5_endTime, '', '', false );

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$schData = CP5_Schedule::get_scheduleByTime( date( 'Y-m-d', $now ), $cp5_startTime, $cp5_endTime, get_current_blog_id(), '', false );
$schData = CP5_Schedule::get_scheduleByTime( date( 'Y-m-d', $now ), $cp5_startTime, $cp5_endTime, get_current_blog_id(), '', false );
$schData = CP5_Schedule::get_scheduleByTime( date( 'Y-m-d', $now ), $cp5_startTime, $cp5_endTime, get_current_blog_id(), '', false );

 

template-parts/page/loop-page-cast.php  1~4行目を下記のように変更

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<?php
global $cp5_gidArr, $machihimeObj,$icon_condition;
$castID = get_the_ID();
?>
<?php global $cp5_gidArr, $machihimeObj,$icon_condition; $castID = get_the_ID(); ?>
<?php
global $cp5_gidArr, $machihimeObj,$icon_condition;
$castID = get_the_ID();
?>

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<?php
global $cp5_gidArr, $machihimeObj,$icon_condition;
$castID = get_the_ID();
$schObj = $cp5_gidArr[$castID][0];
if ( class_exists( 'CP5_Machihime' ) ) {
$thisState = $machihimeObj->get_stateSingle( $castID );
}
$timeFormat = get_option( 'time_format' );
$inTime = date( $timeFormat, CP5::add_gmt_offset( cp5_ms2sec( $schObj->in_time ) ) );
$outTime = date( $timeFormat, CP5::add_gmt_offset( cp5_ms2sec( $schObj->out_time ) ) );
//ラスト表記の確認
$outTime = cp5_is_outTimeLast( get_current_blog_id(), $schObj, $outTime );
?>
<?php global $cp5_gidArr, $machihimeObj,$icon_condition; $castID = get_the_ID(); $schObj = $cp5_gidArr[$castID][0]; if ( class_exists( 'CP5_Machihime' ) ) { $thisState = $machihimeObj->get_stateSingle( $castID ); } $timeFormat = get_option( 'time_format' ); $inTime = date( $timeFormat, CP5::add_gmt_offset( cp5_ms2sec( $schObj->in_time ) ) ); $outTime = date( $timeFormat, CP5::add_gmt_offset( cp5_ms2sec( $schObj->out_time ) ) ); //ラスト表記の確認 $outTime = cp5_is_outTimeLast( get_current_blog_id(), $schObj, $outTime ); ?>
<?php
global $cp5_gidArr, $machihimeObj,$icon_condition;

$castID = get_the_ID();
$schObj = $cp5_gidArr[$castID][0];

if ( class_exists( 'CP5_Machihime' ) ) {
$thisState = $machihimeObj->get_stateSingle( $castID );
}

$timeFormat = get_option( 'time_format' );
$inTime = date( $timeFormat, CP5::add_gmt_offset( cp5_ms2sec( $schObj->in_time ) ) );
$outTime = date( $timeFormat, CP5::add_gmt_offset( cp5_ms2sec( $schObj->out_time ) ) );

//ラスト表記の確認
$outTime = cp5_is_outTimeLast( get_current_blog_id(), $schObj, $outTime );

?>

 

表示したい箇所 template-parts/page/loop-page-cast.php  16行目あたりに、下記を記述

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<?php if($schObj) { ?>
<div class="cast-schedule-time"><?php echo sprintf( '<i class="fa fa-clock-o"></i> <span class="num">%s</span> - <span class="num">%s</span>', $inTime, $outTime ); ?></div>
<?php } ?>
?>
<?php if($schObj) { ?> <div class="cast-schedule-time"><?php echo sprintf( '<i class="fa fa-clock-o"></i> <span class="num">%s</span> - <span class="num">%s</span>', $inTime, $outTime ); ?></div> <?php } ?> ?>
<?php if($schObj) { ?>
<div class="cast-schedule-time"><?php echo sprintf( '<i class="fa fa-clock-o"></i> <span class="num">%s</span> - <span class="num">%s</span>', $inTime, $outTime ); ?></div>
<?php } ?>
?>