Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created April 15, 2019 19:28
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/37d8cd17bbc1cdb1c3af23e5d301b780 to your computer and use it in GitHub Desktop.
Save billerickson/37d8cd17bbc1cdb1c3af23e5d301b780 to your computer and use it in GitHub Desktop.
<?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