get_posts() публичный Метод

Returns the latest/best-matching posts with respect to the given context.
С версии: 3.0.0
public get_posts ( RelationshipContext $context ) : WP_Pos\WP_Post[]
$context Inpsyde\MultilingualPress\Relations\Post\RelationshipContext Relationship context data object.
Результат WP_Pos\WP_Post[] The latest/best-matching posts.
 /**
  * Renders the markup for the search results according to the given context.
  *
  * @since 3.0.0
  *
  * @param RelationshipContext $context Relationship context data object.
  *
  * @return void
  */
 public function render(RelationshipContext $context)
 {
     $posts = $this->search->get_posts($context);
     if (!$posts) {
         echo '<li>' . esc_html__('Nothing found.', 'multilingual-press') . '</li>';
         return;
     }
     $site_id = $context->remote_site_id();
     array_walk($posts, function (WP_Post $post) use($site_id) {
         printf('<li><label for="%4$s"><input type="radio" name="%2$s" value="%3$d" id="%4$s"> %1$s</label></li>', $this->get_post_title($post), esc_attr("mlp_add_post[{$site_id}]"), esc_attr($post->ID), esc_attr("mlp-rc-search-result-{$site_id}-{$post->ID}"));
     });
 }