function ws_ifdef_do($check, $content) { return ws_ifdef_do_else($check, $content, ""); }
$intro = get_field('project_introductory_paragraph'); $bg_image = get_field('project_background_image'); if ($client || $location || $date_started || $project_link || $collaborators || $scope_tags) { echo '<ul>'; echo ws_ifdef_do($client, ws_ifdef_do_else($client_link, '<li><a href="' . ws_decide_link_type($client_link) . '"><h6>' . $client . '</h6></a></li>', '<li><h6>' . $client . '</h6></li>')); // conditionally echos a linked client ( or just a client ) echo ws_ifdef_concat('<li>', $location, '</li>'); // conditionally echos a location echo ws_ifdef_do($date_started, ws_ifdef_do_else($date_ended, '<li>' . ws_render_date($date_started) . ' - ' . ws_render_date($date_ended) . '</li>', '<li>' . ws_render_date($date_started) . '</li>')); // conditionally echo a date range, and format it from Ymd to ws_render_date(); echo ws_ifdef_do($scope_tags, ws_ifdef_concat("<ul>", ws_split_array_by_key($scope_tags, ", </li>", function ($cb_elem) { return '<li>' . $cb_elem['scope_tag']->name; }), "</li></ul>")); // conditionally outputs a ul of comma-separated scope-tags echo ws_ifdef_do($collaborators, ws_ifdef_concat("<ul>", ws_split_array_by_key($collaborators, ", </li>", function ($cb_elem) { return ws_ifdef_do_else($cb_elem['collaborator_link'], '<li><a href="' . ws_decide_link_type($cb_elem['collaborator_link']) . '" >' . $cb_elem['collaborator_name'] . '</a>', '<li>' . $cb_elem['collaborator_name']); }), "</li></ul>")); // this outputs a comma-separated list of links. This is NOT currently an html list. echo ws_ifdef_concat('<a href="', ws_decide_link_type($project_link), '" > more </a>'); // this outputs an external link to more information about this project echo '</ul>'; } echo ws_ifdef_concat('<p>', $intro, '</p>'); // echos the descriptive introductory paragraph beneath the ul of metadata echo ws_ifdef_do($bg_image, ws_decide_image_type($bg_image)); // echos a background image line drawing. ?> </section> <?php