Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active July 4, 2018 12: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/4afed520d309d1e347def90fa71cb5e7 to your computer and use it in GitHub Desktop.
Save billerickson/4afed520d309d1e347def90fa71cb5e7 to your computer and use it in GitHub Desktop.
<?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