]> CyberLeo.Net >> Repos - Github/YOURLS.git/blob - wordpress-plugin/ozh-plc-bridge/generate-short-urls-for-all-posts.php
Initial commit (importing from http://svn.planetozh.com/ozhin)
[Github/YOURLS.git] / wordpress-plugin / ozh-plc-bridge / generate-short-urls-for-all-posts.php
1 <?php
2 /*
3  * NOTE: you're supposed to load this file directly in your browser,
4  * ie http://site.com/wp-content/plugins/ozh-plc-bridge/generate-short-urls-for-all-posts.php
5  */
6
7 // Load the WordPress Environment
8 require('../../../wp-blog-header.php');
9 ?>
10 <h1>Ozh's PLC - WP - Twitter Bridge</h1>
11 <h2>This file generates a short link for all your blog posts (from older to latest)</h2>
12 <ol>
13 <?php
14 add_filter('posts_orderby', create_function('', 'return "post_date ASC";') );
15
16 $archive_query = new WP_Query('showposts=99999');
17
18 while ($archive_query->have_posts()) : $archive_query->the_post();
19         delete_post_meta($archive_query->post->ID, 'yourls_shorturl'); // remove any previously stored short url
20         update_post_meta($archive_query->post->ID, 'yourls_tweeted', 1); // make as if all existing posts had already been tweeted
21         echo '<li>'.wp_ozh_yourls_geturl($archive_query->post->ID) .' = ' . $archive_query->post->post_title . "</li>\n";
22 endwhile;
23 ?>
24 </ol>
25
26 <h3>Done. You can now delete this file !</h3>