Created
October 14, 2014 10:47
-
-
Save mustardBees/0526f7b896e59f6dfd11 to your computer and use it in GitHub Desktop.
WordPress Simple Post List Plugin
This file contains 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 | |
/* | |
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