Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created April 24, 2019 15:58
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 billerickson/5104faa2b1194948783e68fdf8da2240 to your computer and use it in GitHub Desktop.
Save billerickson/5104faa2b1194948783e68fdf8da2240 to your computer and use it in GitHub Desktop.
<?php
/**
* Display Posts, add support for id="current"
* @see https://displayposts.com/2019/04/24/display-current-post/
*
*/
function be_dps_current_post( $args, $atts ) {
if( !empty( $atts['id'] ) && 'current' == $atts['id'] )
$args['post__in'] = array( get_the_ID() );
return $args;
}
add_filter( 'display_posts_shortcode_args', 'be_dps_current_post', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment