Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Author's initials only
Hello,
Is there a way to show just the article’s author’s initials, like some print magazines have? For example, if the author was Dennis Quaid, the output would be DQ. You probably didn’t need an example.
Thanks!
Hicks.
Offline
Re: Author's initials only
<txp:php>foreach(explode(' ',author(array())) as $n)echo substr($n,0,1);</txp:php>
Code is topiary
Offline
Re: Author's initials only
Perfect. Thank you.
Offline
Re: Author's initials only
Note to self: don’t forget you can access strings using array notation. So
<txp:php>foreach ( explode(' ', author(array())) as $n ) echo $n[0];</txp:php>
is a cleaner alternative.
Code is topiary
Offline
Re: Author's initials only
Even more perfecter. Ta.
Offline
Pages: 1