Home › Forums › Product Support Forums › Related Posts Pro for WordPress Support › "Title" keep field exclusive doesn't work, Help!
- This topic has 9 replies, 2 voices, and was last updated 11 years, 5 months ago by
Victor Trujillo.
-
AuthorPosts
-
July 27, 2014 at 12:18 pm #2087
Victor Trujillo
ParticipantHi Ernest
Find attached to this message my settings of “Relevance Options”.
I only want the plugin to “look in the title”. I have tried with different settings like “Keep each field exclusive” off and on. However it’s not working well and I might need more control over the final title that is showed.
My website is all about movies and the “title” field is the NAME of the MOVIE.
I give you an example of the movie: “Man of Steel”.
WHAT IM CURRENTLY GETTING:
“Man of Steel”, “A Man of No Importance”, “Man of the West”…WHAT I NEED:
Only the “Man of Steel” posts.Can you help me please?
-
This topic was modified 11 years, 10 months ago by
Victor Trujillo.
July 28, 2014 at 8:02 am #2093Ernest Marcinko
KeymasterHi!
I believe the problem is that the every post in this case contains the work “Man” which is most likely picked up as a keyword.
If you need very specific results, then I would recommend to select the posts which you need as results (you can do it for each post on the post editor screen, http://i.imgur.com/4byCeeF.png)
Or you can add the keyword “man” to the restricted words list if you feel, that it’s too common. (it’s in the related-posts-pro/restricted.txt file, words are separated by spaces)
Or it is also possible to create a custom field with keywords on the post editor, and select to only look in that custom field on the related posts pro settings page.
I would recommend the first solution, because you can customize the results on a post level – other posts won’t get affected.
July 28, 2014 at 8:10 am #2094Victor Trujillo
ParticipantHi Ernest
None of the solutions you offer me makes any sense having in mind that we have more than 14000 posts/movies.
Would it be that difficult to tweak a little bit to your code and add it to my functions.php?
Im sure its easy as changing a LIKE to a = in the SQL query.
Help me please!
July 28, 2014 at 8:30 am #2095Ernest Marcinko
KeymasterOf course we can try. But please don’t expect google-like relevance, the product is smart, but not as smart as google 😀
Okay, so what I understand is that you are interested in comparing the titles in a more “exact” way. What we should try is to change the query to look for exact title matches, and ignore the individual words from the title.
Open up the reladed-posts-pro/includes/related_content.class.php file. It’s a huge file handling and building up the final quiery for the lookup.
On line 298-303 you should see something like:
$like = implode(' OR ', $parts); if ($like == "") $like = "(1)"; else { $like = "($like)"; }That’s the part you don’t really need anymore, instead let’s change it to an exact title match thing:
/*$like = implode(' OR ', $parts); if ($like == "") $like = "(1)"; else { $like = "($like)"; }*/ $like = "(lower($wpdb->posts.post_title) LIKE '%".strtolower($post->post_title)."%')";As you can see I just commented out the old code and added one line. The new line basically grabs the title and compares it to other post titles.
One last thing, this affect the non-fulltext lookups, sou you should disable the fulltext lookup (http://i.imgur.com/28Bp0mW.png) on the advanced options panel. Also the caching as well.
-
This reply was modified 11 years, 10 months ago by
Ernest Marcinko.
July 28, 2014 at 8:59 am #2097Victor Trujillo
ParticipantHi Ernest
That sounds really good.
Would it be possible to hook this change from the “functions.php” file so the plugin could be updated laters with no problems?
July 28, 2014 at 9:03 am #2098Ernest Marcinko
KeymasterHi!
I’m afraid not. It’s a too deep code change, I can’t really make a hook to it. But most likely I will make an option in the upcoming versions, something like “exact matches only”, so you might not need to change anything.
July 28, 2014 at 9:12 am #2099Victor Trujillo
ParticipantCheers Ernest and sorry for the bother.
Very kind of you. When do you think this update will be available?
I have already added a 5 star rating to your plugin at codecanyon 🙂
July 28, 2014 at 9:15 am #2100Ernest Marcinko
KeymasterNo problem at all 🙂
Oh, thank you for the rating, I just noticed it!
The next update should be out in a month or so. It’s going to be a smaller update with mostly bug fixes and small requests like yours. Right now I’m finishing two other plugin updates, once I’m finished, then Related Posts Pro is next.
July 28, 2014 at 9:21 am #2101Victor Trujillo
ParticipantThanks Ernest, Im looking forward to the update.
-
This reply was modified 11 years, 10 months ago by
Victor Trujillo.
December 17, 2014 at 10:39 pm #3261Victor Trujillo
ParticipantHi Ernest
I am still looking forward to the update 🙂
Are there any plans to release an update?
Please keep good work going. Thanks so much for such beautiful plugins, and remember we still need some updates from your side :))))))
-
This topic was modified 11 years, 10 months ago by
-
AuthorPosts
- The forum ‘Related Posts Pro for WordPress Support’ is closed to new topics and replies.