Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
|
wiki2:wordpress [2015/01/04 17:54] alfred [How to...] |
wiki2:wordpress [2020/05/09 09:25] (actual) |
||
|---|---|---|---|
| Línea 271: | Línea 271: | ||
| <?php endwhile; ?> | <?php endwhile; ?> | ||
| <?php wp_reset_postdata(); ?> | <?php wp_reset_postdata(); ?> | ||
| + | </code> | ||
| + | |||
| + | === Get child pages from front page === | ||
| + | First you must obtain the ID of the front page, it's stored in the wp_options WP table, as option_name=page_on_front and option_value=ID of the page. So if you want to retrieve this value, just use get_option('page_on_front'). | ||
| + | |||
| + | <code php> | ||
| + | <?php $args = array( | ||
| + | 'child_of' => get_option('page_on_front'), | ||
| + | 'post_type' => 'page', | ||
| + | 'post_status' => 'publish', | ||
| + | 'title_li' => '', | ||
| + | ); ?> | ||
| + | <?php $children = wp_list_pages( $args ); ?> | ||
| + | <?php if ($children) : ?> | ||
| + | <ul> | ||
| + | <?php echo $children; ?> | ||
| + | </ul> | ||
| + | <?php endif; ?> | ||
| </code> | </code> | ||
| ==== Other functionalities ==== | ==== Other functionalities ==== | ||