function getNameUniversal($row, $order, $hcard = null) { global $text, $admtext, $tngconfig, $nonames; //$nonames = showNames($row); $lastname = trim($row['lnprefix'] . " " . $row['lastname']); if ($tngconfig['ucsurnames']) { $lastname = tng_strtoupper($lastname); } if ($hcard) { $lastname = "<span class=\"family-name\">" . $lastname . "</span>"; } $title = $row['title'] && $row['title'] == $row['prefix'] ? $row['title'] : trim($row['title'] . " " . $row['prefix']); if (($row['allow_living'] || !$nonames) && ($row['allow_private'] || !$tngconfig['nnpriv'])) { $firstname = $hcard ? "<span class=\"given-name\">" . $row['firstname'] . "</span>" : $row['firstname']; $firstname = trim($title . " " . $firstname); $namestr = constructName($firstname, $lastname, $row['suffix'], $order); } elseif ($row['living'] && !$row['allow_living'] && $nonames == 1) { $namestr = $text['living']; } elseif ($row['private'] && !$row['allow_private'] && $tngconfig['nnpriv'] == 1) { $namestr = $admtext['text_private']; } else { //initials $firstname = $hcard ? "<span class=\"given-name\">" . initials($row['firstname']) . "</span>" : initials($row['firstname']); $firstname = trim($title . " " . $firstname); $namestr = constructName($firstname, $lastname, $row['suffix'], $order); } if ($hcard) { $namestr = "<span class=\"n\">{$namestr}</span>"; } return $namestr; }
/** * The template for displaying all pages. * * This is the template that displays all pages by default. * Please note that this is the wordpress construct of pages * and that other 'pages' on your wordpress site will use a * different template. * * @package WordPress * @subpackage Boilerplate * @since Boilerplate 1.0 */ function initials($name) { // preg_match_all('~\b(\S){1}~', $this->name, $matches); // return $matches[1][0].end($matches[1]); $name = explode(' ', $name); $last = end($name); $first = reset($name); return strtoupper($first[0]) . strtoupper($last[0]); } $data = Timber::get_context(); $pi = new TimberPost(); $data['post'] = $pi; $people = get_field('person', $pi->ID); foreach ($people as &$person) { $person['initials'] = initials($person['name']); } $data['people'] = $people; $data['wp_title'] = 'About Upstatement'; Timber::render('page-about.twig', $data);
function getFirstNameOnly($row) { global $text, $admtext; $nonames = showNames($row); if ($row['allow_living'] && $row['allow_private'] || !$nonames) { $namestr = strtok($row['firstname'], " "); } elseif ($nonames == 2) { $namestr = initials($row['firstname']); } elseif ($row['private']) { $namestr = $admtext['text_private']; } else { $namestr = $text['living']; } return $namestr; }