I want to pull latest post and embed other 2 first result posts?

by Elma Elma   Last Updated September 13, 2017 14:08 PM

User will search/submit at the same time.

<input id="user-submitted-title" name="user-submitted-title" type="text" value="" placeholder="<?php esc_attr_e('Search', 'usp'); ?>"<?php if (usp_check_required('usp_title')) echo $usp_required; ?> class="usp-input">

This one is the form from wordpress plugin, and its only for a title, and I use that only. When user submits this by title, I have other code which will add post into my wordpress site by bunch of other codes.

I already have a query:

include 'wp-load.php';

$args = array(
    'post_type' => 'post',
    'posts_per_page'    => 1

$query = new WP_Query($args);

    $data = '';
    $data .= '<h1 style="text-align: center; margin: 0; margin: 0px 0 10px 0px;">'.get_the_title().'</h1>';
    $data .= '<div class="description">'.do_shortcode(get_the_content()).'</div>';

echo $data;  ?>

So this one basically shows their or the latest post from the wordpress site on same page with search/submit button.

Except this I want to acomplish that to get and embed content of the other site posts found by query from input and embed them after the one above.

How to do this?

Related Questions

functions.php not sending ajax request

Updated February 21, 2018 21:08 PM

Open PrettyPhoto (not a plugin) from dynamic link

Updated April 12, 2015 20:03 PM

external online js files Doesn,t work in wordpress?

Updated April 10, 2017 08:08 AM