could you please help me to correct the code. I need to display related posts based on the PAGE TITLE keywords, so when page (not post) loads it shows title+content and related block of posts underneath.
I have this code but it displays the weird results.
<?php
$mypostids = $wpdb->get_col("select ID from $wpdb->posts where post_title LIKE '".$str."%' ");
$args = array(
'post__in'=> $mypageids,
'post_type'=>'post',
'orderby'=>'title',
'order'=>'asc',
'posts_per_page'=>3,
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
_e("");
while ( $the_query->have_posts() ) {
$the_query->the_post();
?>
%
before and after the$str
? Like soLIKE '%".$str."%'
.