Created
April 20, 2011 18:13
-
-
Save rabdano/932187 to your computer and use it in GitHub Desktop.
Получить массив постов WordPress отсортированых в обратном порядке по ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $args = array( | |
| 'post_type' => 'тип поста', | |
| 'posts_per_page' => -1, | |
| 'orderby' => 'id', | |
| 'order' => 'DESC' | |
| ); | |
| $posts = get_posts( $args ); | |
| foreach ( $posts as $post ) { | |
| setup_postdata( $post ); | |
| $title = get_the_title( $post->ID ); | |
| $id = $post->ID; | |
| echo "ID = $id\nTitle = $title"; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment