• Hello, I have a multilingual website which uses Polylang plugin.
    I found this code which uses wp_list_pages to display parent and all child pages, but when I’m changing the language, list of pages is still in default language. What I need is, modify this code, that when I’m changing the languge, it will display the translated list of pages or if no translation is avalible, then the default one.
    Here is the original code.

    <?php
    $parent = 93;
    $args=array(
      'child_of' => $parent
    );
    $pages = get_pages($args);
    if ($pages) {
      $pageids = array();
      foreach ($pages as $page) {
        $pageids[]= $page->ID;
      }
    
      $args=array(
        'title_li' => 'Tree of Parent Page ' . $parent,
        'include' =>  $parent . ',' . implode(",", $pageids)
      );
      wp_list_pages($args);
    }
    ?>

    Could someone help me please?

  • The topic ‘List parent Page and all descendant Pages with Polylang plugin’ is closed to new replies.