"Title" keep field exclusive doesn't work, Help!

Home Forums Product Support Forums Related Posts Pro for WordPress Support "Title" keep field exclusive doesn't work, Help!

This topic contains 9 replies, has 2 voices, and was last updated by Victor Trujillo Victor Trujillo 7 years, 8 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2087
    Victor Trujillo
    Victor Trujillo
    Participant

    Hi 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?

    Attachments:
    You must be logged in to view attached files.
    #2093
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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, https://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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #2094
    Victor Trujillo
    Victor Trujillo
    Participant

    Hi 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!

    #2095
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Of 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 (https://i.imgur.com/28Bp0mW.png) on the advanced options panel. Also the caching as well.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #2097
    Victor Trujillo
    Victor Trujillo
    Participant

    Hi 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?

    #2098
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #2099
    Victor Trujillo
    Victor Trujillo
    Participant

    Cheers 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 πŸ™‚

    #2100
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    No 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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #2101
    Victor Trujillo
    Victor Trujillo
    Participant

    Thanks Ernest, Im looking forward to the update.

    #3261
    Victor Trujillo
    Victor Trujillo
    Participant

    Hi 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 :))))))

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.