i need to get posts by search in posts title only not search in full post & put the posts in loop to show it in a slider
Note : i need to get posts by keyword in title & put it in loop to showing it, not limiting search in all of the site
i used wp_query
to do that but it is get posts by searching in full post “content&title”
<?php $query = new WP_Query( 's=mykeyword&cat=22,32&order=dsc&showposts=6' ); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<p><?php the_title(); ?></p>
<?php endwhile; ?>
<?php endif; ?>
how can i do that
If you want to limit the filter from this answer (add that function to your plugin or your themeâs
functions.php
) just to one query, remove the filter when you are done: