0

I'm making a newspaper, and I want to have two different options for viewing posts: "web" (for viewing with laptop, smartphone, etc.) and "billboard" (dynamically cycles through the content; meant for a TV display in our lobby). These are two completely different HTML layouts.

The way I currently have it is very messy; all the code is in one single-newspaper.php file and there is an if-statement to check which viewing option (query var) before any HTML.

Although it works, it is a really ugly way of doing it, and I was wondering if there are any neater options. I'd like to have something like:

  • single-newspaper.php: Checks the viewing option and displays either:
  • newspaper/newspaper_web.php: For web viewing
  • newspaper/newspaper_tv.php: TV mode

Is this possible?

1
  • Have a look at this question, similar problem / solution.
    – Milo
    Commented Jun 26, 2017 at 23:24

1 Answer 1

0

Yes, you can check the viewing option in single-newspaper.php, and then use get_template_part to load the appropriate template part.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.