-
-
Save billerickson/37d8cd17bbc1cdb1c3af23e5d301b780 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* 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