SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | ||
| 3 | include "wp-load.php"; | |
| 4 | ||
| 5 | - | /*you have 2 options in the line below |
| 5 | + | /* You have 2 options in the line below: |
| 6 | - | staus= publish will return posts and pages with type, URL and title |
| 6 | + | |
| 7 | - | status= any will return in addition any attachments such as images |
| 7 | + | status=publish |
| 8 | - | in that post immediately after in the list with URL and file name */ |
| 8 | + | ... will return posts and pages with type, URL and title, |
| 9 | - | $posts = new WP_Query('post_type=any&posts_per_page=-1&post_status=publish');
|
| 9 | + | |
| 10 | status=any | |
| 11 | ... will return in addition any attachments such as images | |
| 12 | in that post immediately after in the list with URL and file name. */ | |
| 13 | - | header('Content-type:text/plain');
|
| 13 | + | |
| 14 | $posts = new WP_Query('post_type=any&posts_per_page=-1&post_status=any');
| |
| 15 | $posts = $posts->posts; | |
| 16 | - | case 'revision': |
| 16 | + | $categories = get_categories('hide_empty=false');
|
| 17 | - | case 'nav_menu_item': |
| 17 | + | |
| 18 | header('Content-type:text/plain; charset=utf-8');
| |
| 19 | foreach($posts as $post) {
| |
| 20 | switch ($post->post_type) {
| |
| 21 | case 'attachment': | |
| 22 | $permalink = get_attachment_link($post->ID); | |
| 23 | break; | |
| 24 | case 'page': | |
| 25 | $permalink = get_page_link($post->ID); | |
| 26 | break; | |
| 27 | case 'post': | |
| 28 | $permalink = get_permalink($post->ID); | |
| 29 | break; | |
| 30 | default: | |
| 31 | $permalink = get_post_permalink($post->ID); | |
| 32 | - | echo "\n{$post->post_type}\t{$permalink}\t{$post->post_title}";
|
| 32 | + | |
| 33 | } | |
| 34 | echo "\n{$post->post_type}\t{$permalink}";
| |
| 35 | } | |
| 36 | foreach ($categories as $cat) {
| |
| 37 | ||
| 38 | $id = get_the_ID(); | |
| 39 | $category = get_the_category($id); | |
| 40 | ||
| 41 | echo "\ncategory\t"; | |
| 42 | echo ''.get_option('home').'/'.get_option('category_base').'/'.$cat->category_nicename.'';
| |
| 43 | } | |
| 44 | ?> |