Get_pages array shows default language
-
I tweaked the get_pages example code on www.ads-software.com to show the title, page_link and some custom fields of a childpage on the homepage, but the code only returns the content of the default language. I would like the code to retrieve the content of the current language.
<ul id="latest"> <?php $mypages = get_pages( array( 'child_of' => 23, 'sort_column' => 'menu_order', 'number' => '1', 'offset' => '0', 'sort_order' => 'asc' ) ); foreach( $mypages as $page ) { $content = $page->post_content; if ( ! $content ) // Check for empty page continue; $content = apply_filters( 'the_content', $content ); ?> <li id="latest" style="background: <?php the_field('kleurcode_project', $page->ID); ?>;"> <h2><a href="<?php echo get_page_link( $page->ID ); ?>" style="color:<?php the_field('kleurcode_tekst', $page->ID); ?>"><?php echo $page->post_title; ?></a></h2> <p><a href="<?php echo get_page_link( $page->ID ); ?>" style="color:<?php the_field('kleurcode_tekst', $page->ID); ?>"><?php the_field('short_text', $page->ID); ?></a></p> <a href="<?php echo get_page_link( $page->ID ); ?>"><img src="<?php the_field('featured_image', $page->ID); ?>"></a> </li> <?php } ?> </ul>
I couldn’t find an answer to this question on the forums, I would surely appreciate getting to know the solution.
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Get_pages array shows default language’ is closed to new replies.