Search Results

This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 3 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #19593
    wellstudio
    wellstudio
    Participant

    Hello,

    I have used your plugin to add different post types such as Categories and Authors to the standard WordPress search results. Unfortunately all of these are returning with the same Post ID (-10) and there seems to be no way to differentiate them from other post types. This is frustrating as they all get images from different places and I am stuck without images for the non standard results. Is there anyway to fix this?

    Kind Regards
    Andy

    #19599
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Andy,

    It is unfortunately neccessary to set an ‘invalid’ post ID, as otherwise wordpress would automatically treat them as post types, leading to major errors and malfunctions. I am not sure if it is possible to pass on the original ID to the results page, as objects are usually re-queried there.

    I made a possible modification to the main functions file, so that it will try to pass on the original ID as a different object property. To apply this change:

    1. Please open up the wp-content/plugins/ajax-search-pro/includes/functions/functions.php file on your server
    2. Change it’s contents to this.
    3. Save the file

    Now, in your custom code, the ‘asp_id‘ property should hold the original object ID. So if the $post variable is the post object, then $post->asp_id should be the original ID.

    Please note, that this may not work at all, as there is a very highy chance, that WordPress simply re-queries the post objects after the plugin passes it to it, and this information is lost then.

    Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.