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?

  • Have a look at this question, similar problem / solution. – Milo Jun 26 '17 at 23:24
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, privacy policy and cookie policy

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