Custom Post Types in loop

Are there other methods in FrontPage.php that work fine and only this one fails? Or do any methods in FrontPage.php fail? If the later, you may be getting thrown off by Controller’s inheritance pattern—specifically that (unless you enable tree) only two controllers can apply at the same time: App, and whatever one matches your current endpoint first. More in-depth explaination here:

Thanks alwaysblank, I understand my mistake now :
Controllers are linked to the wordpress template Hierarchy and this is where I had to take a look.
I forgot the FrontPage.php is used to render the site’s front page. Actually my production website is hide behind an “on construction” index.html webpage, so the webpage I tested was not set as a front page in wordpress. This is why on production server, FrontPage.php fail.

P.S : Thanks again for your attention and your patience because I’m not sure to be always very clear when I’m writing in english. :confused:

Glad you figured it out.

I don’t use this trick much anymore because I’m not usually working on “under construction” sites, but you can use server redirects to redirect every IP that’s not yours somewhere else—say, a static file that says “under construction.” This is one example, using .htaccess (i.e. if you’re on Apache): https://stackoverflow.com/questions/8985502/htaccess-redirect-to-all-ips-but-mine With this approach you don’t need to worry about the kind of dev/prod parity issues you ran into here, because only you have access to the actual production server, negating the need to have WordPress itself in a different state on the production server.

Hi there! Now i have 2 questions about passing data from controller to views:

  1. Is it possible to make pagination on custom template with public function loop? Or we have to use archive-template and use standard wordpress loop and pagination?

  2. WPML plugin doesn’t include translation in database, instead it duplicates posts on both languages. So the question is: how to tell to loop that i want posts on particular language? I have carousel on all pages and after i use wpml plugin carousel shows duplicates posts with both languages.

Thank you!

1 Like

This is more of a WordPress general question, than a Sage-specific one. Here’s a possible solution from Google:

1 Like

Ooooh, now i understand where to dig. Thank you sir!

Might be worth looking at Timber’s implementation . I think they’ve restructured it to do it automatically, but you had to run query_posts

I’ll see if I can find the old link
https://timber.github.io/docs/guides/pagination/