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:

<?php
include 'wp-load.php';

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

$query = new WP_Query($args);

if($query->have_posts()):
    $data = '';
    while($query->have_posts()):$query->the_post();
    $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>';

endwhile;endif;
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


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


How to make jquery number counter dynamic?

Updated March 02, 2017 12:08 PM