Skip to content

Instantly share code, notes, and snippets.

@billerickson

billerickson/functions.php Secret

Created Apr 24, 2019
Embed
What would you like to do?
<?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