• カテゴリー別アーカイブ UNIT TEST
  • image 3

    public-domain-images-free-stock-photos-flower-ball
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


  • image 2

    public-domain-images-free-stock-photos-palma-geographic-wood-door
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


  • Gist

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    <?php
    add_filter( 'get_the_date', 'japan_date', 11 );
    function japan_date( $date ) {
    global $post;
    $time_format = get_option( 'time_format' );
    $time = get_the_time( $time_format, $post->ID );
    $html = '%1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s';
    $force_gengou = '';
    $year_name = '年';
    $month_name = '月';
    $day_name = '日';
    $error = $date;
    $gengou = array( '平成' => mktime( 0, 0, 0, 1, 8, 1989 ),
    '昭和' => mktime( 0, 0, 0, 12, 25, 1926 ),
    '大正' => mktime( 0, 0, 0, 7, 30, 1912 )
    );
    $date = preg_replace( '|[^0-9A-z]+|', '-', $date );
    $date = str_replace( array( 'am', 'pm', 'AM', 'PM' ), '', $date );
    $date = apply_filters( 'japan_date_input', $date );
    arsort( $gengou );
    $date = date_parse( $date );
    $year = $date[ "year" ];
    $month = $date[ "month" ];
    $day = $date[ "day" ];
    $hour = $date[ "hour" ];
    $minute = $date[ "minute" ];
    $second = $date[ "second" ];
    $fraction = $date[ "fraction" ];
    $warning_count = $date[ "warning_count" ];
    $warnings = $date[ "warnings" ];
    $error_count = $date[ "error_count" ];
    $errors = $date[ "errors" ];
    $is_localtime = $date[ "is_localtime" ];
    if ( $year == false ) {
    return $error;
    }
    if ( $month == false ) {
    return $error;
    }
    if ( $day == false ) {
    return $error;
    }
    if ( $error_count > 1 ) {
    return $error;
    }
    if ( $hour == false or
    $minute == false or
    $second == false ) {
    $hour = 0;
    $minute = 0;
    $second = 0;
    }
    $input_date = mktime( $hour, $minute, $second, $month, $day, $year );
    if ( empty( $force_gengou ) ) {
    foreach ( $gengou as $key => $val ) {
    if ( $input_date >= $val ) {
    $start = date( 'Y', $val );
    $year = $year - $start + 1;
    $result = sprintf( $html, $key, $year, $year_name, $month, $month_name, $day, $day_name, $time );
    return $date = apply_filters( 'japan_date_output', $result );
    }
    }
    } else {
    $start = date( 'Y', $gengou[ $force_gengou ] );
    $year = $year - $start + 1;
    $result = sprintf( $html, $force_gengou, $year, $year_name, $month, $month_name, $day, $day_nam, $timee );
    return $date = apply_filters( 'japan_date_output', $result );
    }
    }
    ?>
    view raw functions.php hosted with ❤ by GitHub

  • twitter2