Roots Discourse

WPML: How to use controllers/templates

Hello, I would like to understand how to work with WPML and Sage 9.

Right now, I have to create 2 controllers, 2 blade templates because I use 2 languages.
example: PageAllo.php, PhpHello.php and 2 templates.

It’s because Sage 9 uses the Page’s name to work with the controller. That’s why I use 2 controllers, and 2 blade templates.

Is that the way to work, with WPML and Sage 9 even if the only difference is the language?

Thank you.

Do you have to use the page-{slug} template?
You could switch to a custom page templates to avoid that problem.

To make this work, I need have duplicates of each files:

PageHello.js(I’m running Vue for this page, but not required for other pages)
PageHello.blade.php
Content-Single-Hello.blade.php
(This means, duplicates of those files, but in the translated page title)

I managed to use a template after thinking about it. Now the problem is narrowed down to the content-single-hello.blade.php. I did not think of using the {slug} attribute. I’ll try it out.
edit: it won’t work, how do I associate that content-single to be used only on the page slug I want?

This topic was automatically closed after 42 days. New replies are no longer allowed.