0

I'm currently using the author.php template to display a frontend archive of users' posts from all roles. I've now created a new user role ("trainer") that needs to have a completely different frontend template to the other user roles.

My instinct was that I would be able to create a template with a naming convention like user-trainer.php or trainer.php that would only apply to users with the "trainer" role, but after looking through the Wordpress docs this does not appear to be a thing.

Does anyone have any suggestions on how I could achieve this other than just doing an if statement that checks the user role in author.php?

  • What is the purpose of doing this? – Arsalan Mithani Oct 23 '19 at 10:27
  • @ArsalanMithani So that the trainer users can have a different front end template for their "archive" page. Other user roles have a basic template in which their name and posts are displayed, the trainers have a vastly different template. – JJ Gerrish Oct 23 '19 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.