• I am running a news website, where I want to be able to tag people who are featured in the post.

    However, I also want a page where I can list these people, surname first.

    I have looked at using tags, but can only list “John Smith” or “Smith John”, when what I really want is “Smith, John”.

    Does anyone know of a workaround or potential plug-in which would allow me to achieve this?

    many thanks

Viewing 1 replies (of 1 total)
  • 1 option while still using tags would be to break apart the name and re-order the first/last names.. something like

    // cycle through names
    foreach ($names as $name) {
    
      // separate at the SPACE between names
      $break_name = explode(" ", $name);
    
      // last name show before, first name after
      echo "<a ... >{$break_name[1]}, {$break_name[0]}</a>";
    }

    but what you’ll find is not every name has just 2 names.. many may have 3 or 4.. however you might be able to expand on above and do something like: show the *very* last $break_name key first, then follow with remaining keys after the coma (wether it be just one, or more)

Viewing 1 replies (of 1 total)
  • The topic ‘Featured people in post – any way around commas in tags?’ is closed to new replies.