Skip to content

Instantly share code, notes, and snippets.

@mustardBees
Created October 14, 2014 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mustardBees/0526f7b896e59f6dfd11 to your computer and use it in GitHub Desktop.
Save mustardBees/0526f7b896e59f6dfd11 to your computer and use it in GitHub Desktop.
WordPress Simple Post List Plugin
<?php
/*
Plugin Name: Simple Post List
Plugin URI: http://www.iwebcontrol.co.uk/
Description: Simple plugin to output a list of blog post URLs.
Version: 1.0.0
Author: Phil Wylie
Author URI: http://www.iwebcontrol.co.uk/
License: GPLv2+
*/
/**
* /?iweb_simple_post_list=1
*/
if ( isset( $_GET['iweb_simple_post_list'] ) ) {
add_action( 'template_redirect', function() {
$args = array(
'posts_per_page' => -1,
'post_type' => 'post'
);
$posts = new WP_query( $args );
if ( $posts->have_posts() ) {
while ( $posts->have_posts() ) {
$posts->the_post();
the_permalink();
echo "\r\n";
}
}
wp_reset_postdata();
die();
} );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment