Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created Apr 15, 2019
Embed
What would you like to do?
<?php
/**
* Display Posts - Posts to Posts support
* @see https://displayposts.com/2019/04/15/display-connected-content-using-posts-to-posts-plugin/
*/
function be_dps_p2p( $args, $atts ) {
if( empty( $atts['connected_type'] ) )
return $args;
$args['connected_type'] = esc_attr( $atts['connected_type'] );
if( !empty( $atts['connected_items'] ) )
$args['connected_items'] = intval( $atts['connected_items'] );
else
$args['connected_items'] = get_queried_object_id();
return $args;
}
add_filter( 'display_posts_shortcode_args', 'be_dps_p2p', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment