I stumbled upon an issue that I'm not sure how to go forward with. My theme creates two pages on activation. The fact that there are two doesn't matter, it could be 10 pages but just for the background:
- One page can be selected as a FrontPage.
- Another one is used to display all categories.
Both pages use specific page templates, like this:
update_post_meta( $page_id, '_wp_page_template', 'page-all-categories.php' );
Specific styles and scripts and enqueued in my functions.php file like this:
if ( is_page( esc_html__( 'All Categories', 'myslug' ) ) ) {
// enqueue all categ page styles & scripts
}
The theme reviewer asked me to have all static strings translated, including these and it makes sense.
However, if the language is switched, with my current approach, these pages will no longer be detected with is_page(esc_html__('MyTheme Front Page', 'myslug')
because the title is now in another language.
I assume that re-creating these pages automatically on language switch should solve the issue but I'm not sure what hook I should use, or if I should go in this direction.