get_pages by slug
-
Hello,
I want to get certain pages, I can do this by the code below, but is it also possible to do this by a slug? So when I delete the page I do not have to modify the code?
<?php $mypages = get_pages( array( 'include' => '220', 'sort_column' => 'post_date', 'sort_order' => 'desc' ) ); foreach( $mypages as $page ) { $content = $page->post_content; if ( ! $content ) // Check for empty page continue; $content = apply_filters( 'the_content', $content ); ?> <h2><a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?></a></h2> <div class="entry"><?php echo $content; ?></div> <?php } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get_pages by slug’ is closed to new replies.