Yes well actually.
My client wants me to build a homepage were the location of certain pages is fixed.
So I need to get pages by slug.
I hoped I could just give the slug in english and then check if there are translations available.
$post = get_posts(array(
'name' => $slug,
'post_type' => 'any'
))[0];
$id = $post->ID;
$id = get_translation(cml_get_current_language()->cml_language_slug, $id);
This doesn’t work however because the slugs are different for each language and somehow get_posts
only returns a post if it is found to be in the current language.
is there a way around this (eg use get_posts
to find all posts in any language, or translate the slug automatically)?