Getting a Listing Of All Post Permalinks in WordPress
I decided to write a blog in django, it's about 95% done. The end goal is to migrate everything from this wordpress powered site to the new one. The url patterns are different on my new blog so I have to do some rewrites. Because of how the permalinks are structure in this blog I need to re-write each one to match the new url pattern. Sooo I need a list of all the permalinks. This is what I came up with, man I haven't written anything in php in FOREVER. /var/www/www.copyandwaste.com/htdocs/list_links.php:
<html>
<head>
</head>
<body>
<?php
require('./wp-blog-header.php');
?>
<?php
global $post;
$count_posts = wp_count_posts();
$published_posts = $count_posts->publish;
$args = array('numberposts' =>$published_posts);
$myposts = get_posts($args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<?php the_permalink(); ?> <br/>
<?php endforeach; ?>
</body>
</html>
This outputs a list of permalinks:
... http://www.copyandwaste.com/2012/03/01/google-authorship-markup-django-search-results/ http://www.copyandwaste.com/2012/02/28/using-content-disposition-django-decorators-and-ssi-to-enable-users-to-download-html-files/ http://www.copyandwaste.com/2012/02/21/301-permanently-moved-apache2-mod_rewrite/ http://www.copyandwaste.com/2012/01/06/installing-hubot-as-a-campfire-bot-on-ubuntu-10-04-2/ http://www.copyandwaste.com/2011/10/13/multiprocessing-snmp-with-python/ ...
0 Comments
Log in with Twitter, Google, Facebook, LinkedIn to leave a comment.