@ 2020-02-06T22:42:46Z <?php
define('ICL_LANGUAGE_CODE', 'en');
function the_title($str1, $str2) {
echo $str1 . "House Sitting Days" . $str2;
}
$json = '{
"house_sitting_date_current_month": ["2020-02-01", "2020-02-02", "2020-02-03", "2020-02-04", "2020-02-05", "2020-02-06"],
"house_sitting_date_yes_no_current_month": ["yes", "nada", "nada", "nada", "yes", "yes"],
"house_sitting_date_next_month": ["2020-03-01", "2020-03-02", "2020-03-03", "2020-03-04", "2020-03-05", "2020-03-06"],
"house_sitting_date_yes_no_next_month": ["no", "yes", "yes", "nada", "nada", "nada"],
"toggle_status": null
}';
$data_house = json_decode($json);
$date = date("Y-m-d");
$sitting_day_str_en = "Sitting day";
$not_a_sitting_day_str_en ="Not a Sitting Day";
if (($k = array_search($date, $data_house->house_sitting_date_current_month)) !== false) {
$sitting = $data_house->house_sitting_date_yes_no_current_month[$k];
$sitting_str_en = $sitting == 'yes' ? $sitting_day_str_en : ($sitting == 'no' ? $not_a_sitting_day_str_en : '');
}
elseif (($k = array_search($date, $data_house->house_sitting_date_next_month)) !== false) {
$sitting = $data_house->house_sitting_date_yes_no_next_month[$k];
$sitting_str_en = $sitting == 'yes' ? $sitting_day_str_en : ($sitting == 'no' ? $not_a_sitting_day_str_en : '');
}
else {
// not found
$sitting_str_en = 'No data available';
}
?>
<header class="entry-header container">
<?php
the_title('<h1 class="entry-title-house">', '</h1>');
?>
<span class="current-date"><?php echo $date ?></span><!-- prints today's date--> // Line B
<?php if (ICL_LANGUAGE_CODE == 'en') { ?> <!-- English -->
<span class="current-date-answer"><?= $sitting_str_en ?></span> // Line C
<?php } ?>
</header>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.33 , 8.2.0 - 8.2.29 , 8.3.0 - 8.3.26 , 8.4.1 - 8.4.13 <header class="entry-header container">
<h1 class="entry-title-house">House Sitting Days</h1> <span class="current-date">2020-06-25</span><!-- prints today's date--> // Line B
<!-- English -->
<span class="current-date-answer">No data available</span> // Line C
</header> preferences:dark mode live preview ace vim emacs key bindings
119.59 ms | 408 KiB | 5 Q