简体   繁体   中英

Wordpress: trouble with the relevanssi plugin

I am not getting any results with the following code even though one of my posts has the word banana in its title. I have enabled these custom post types and built the index.

$args = array(
                    'post_type' => $search_type,
                    'posts_per_page' => $per_page,
                    'paged' => $requested_page
                );

$args['s'] = 'banana';

global $wp_query;
            $display_cures = new WP_query($args);
            $display_cures->query_vars = $wp_query->query_vars;
            relevanssi_do_query($display_cures);    

while($wp_query->have_posts()) : $wp_query->the_post();
...

I have been trying to make this plugin work all day. Any and all help is appreciated

Try this

the $display_cures object contains the post details

if ( $display_cures->have_posts() ) {
    while ( $display_cures->have_posts() ) {
        $display_cures->the_post();
        echo get_the_title();
        //
        // Post Content here
        //
    } // end while
} // end if

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM