Forked from rabdano/List WordPress posts and sort by ID
Last active
August 29, 2015 14:21
-
-
Save vadim4err/d834e1d0586956177152 to your computer and use it in GitHub Desktop.
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