Insite Sitemap (not autogenerated)
-
Polylang works very smoothly sofar, and i thank the Author Chouby for that.
But i’m having trouble with a custom sitemap page :
My site uses only (sofar) pages, not posts and i need to add a sitemap page, that would of couse be also translatable.My pages use order and are hierarchical (there are children).
So i made a template page, and would like to display the hierarchy of pages (for a starter), according the language
I’ve tried$lang = ( function_exists( 'pll_current_language' )) ? pll_current_language() : 'fr'; $args = array( 'post_type' => 'page', 'parent' => 0, 'lang' => $lang, 'orderby' => 'menu_order', 'order' => 'ASC', ); //To show the level 0 pages, ordered by the page order ASC $pages = get_posts( $args ); echo '<ul class="sitemap">'; foreach( $pages as $p ) { echo '<li><h2><a href="'.get_permalink($p->ID).'">'.$p->post_title.'</a></h2>'; $sub_page_args = array( 'post_type' => 'page', //'parent' => $p->ID, 'child_of' => $p->ID, 'lang' => $lang, 'sort_order' => 'ASC' ); $sub_pages = get_posts( $args ); if( ! empty($sub_pages) ) { echo '<ul>'; foreach( $sub_pages as $sub_p ) { echo '<li><h3><a href="'.get_permalink($sub_p->ID).'">'.$sub_p->post_title.'</a></h3></li>'; } echo '</ul>'; } echo '</li>'; } echo '</ul>';
but doesn’t show even a little the order, or the complete list
I also tried to use get_pages but it’s even worse.
How do you use the ‘lang’ parameter in those requests ?
what field does it refers to ? I didn’t find it in wp_posts nor wp_postmeta. I would be interested to know if i want to make a direct wp_Query.
have you any suggestion to display this kind of sitemap (for pages here) ?
Thanks in advance
- The topic ‘Insite Sitemap (not autogenerated)’ is closed to new replies.