Closed rain2o closed 1 month ago
Another location you could do this https://github.com/Myzwer/foothillschurch/blob/effc5bbf81497ae99f0561ab7849412fe9272bfd/messages.php#L105
'paged' => get_query_var( 'paged' ) ?? 1,
This whole section https://github.com/Myzwer/foothillschurch/blob/effc5bbf81497ae99f0561ab7849412fe9272bfd/single-event.php#L47-L69
Could be reduced to 1 or 3 lines, depending on if you want to break it up.
<h2 class="text-lg font-bold uppercase">
<?php echo get_field('event_start_time') ?? "TBD"; ?> - <?php echo get_field('event_end_time') ?? "TBD"; ?>
</h2>
Another place you can implement this optimization https://github.com/Myzwer/foothillschurch/blob/eb77c6d3119be03e7efd20408e627b1ab9af7aed/components/blocks/event-type.php#L25
$count = get_sub_field( "num_events" ) ?? 3;
and here in the same file https://github.com/Myzwer/foothillschurch/blob/eb77c6d3119be03e7efd20408e627b1ab9af7aed/components/blocks/event-type.php#L62
Also here, can simplify a few things with these conditions.
and
for example
$link = get_sub_field('button_link') ?? get_sub_field('button_link_file');
// Get tab status
$new_tab = get_sub_field('new_tab');
$attrs = null;
if ($tab == "yes") {
$attrs = 'target="_blank"';
} elseif ($tab == "cc") {
$attrs = "data-open-in-church-center-modal='true'";
}
In cases like this, where you are using the value if it exists, otherwise setting a fallback:
https://github.com/Myzwer/foothillschurch/blob/effc5bbf81497ae99f0561ab7849412fe9272bfd/linktree.php#L19-L25
You can use null coalescing to simplify it. This also means you only call the function once.