Hello!
My name is Razvan and I work as a (front-end) web developer in Bucharest, Romania.
I am using the Simple Staff List Word Press plugin on THIS page. I have used the guidance here to sort staff members by full name.
I need to order them by last name. For this, even though I am new to PHP, I have written the code below:
<?php
$name = "Firstname Middlename Lastname";
$name_parts = explode(' ',$name);
$no_of_parts = sizeof($name_parts);
$last_name_index = $no_of_parts - 1;
$last_name = $name_parts[$last_name_index];
$first_names = chop($name,$last_name);
$reverse_name = $last_name . ' ' . $first_names;
?>
It is made to move the last name at the beginning of the full name, store the result in the $reverse_name, and then sort by $reverse_name. It does move the last name at the beginning of the full name, but I can't do this 2 things:
1) Use the value of the staff member post title as value for the $name variable;
2) Use $reverse_name for sorting.
Can anyone give me a hint on what to change in the plugin files to achieve this goal, please?
Thank you!
Razvan Zamfir