-
-
Save billerickson/4afed520d309d1e347def90fa71cb5e7 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 | |
/** | |
* Polylang support for Display Posts Shortcode | |
* | |
* @author Bill Erickson | |
* @see https://wordpress.org/support/topic/display-posts-in-a-specific-language/ | |
* | |
* @param array $args, WP Query arguments | |
* @param array $atts, Shortcode attributes | |
* @return array $args | |
* | |
*/ | |
function be_polylang_support_dps( $args, $atts ) { | |
if( !empty( $atts['lang'] ) ) | |
$args['lang'] = esc_attr( $atts['lang'] ); | |
return $args; | |
} | |
add_filter( 'display_posts_shortcode_args', 'be_polylang_support_dps', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment