[Resolved] Hint needed: mixing search results from another database into WP?

Home Forums Support [Resolved] Hint needed: mixing search results from another database into WP?

Home Forums Support Hint needed: mixing search results from another database into WP?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #342434
    Marcus

    Hello,

    I am aware that this is not a correct request related to GP, but I need some hints for e.g. keywords to search for the correct code sniplets. All I want is avoiding to run into a totally wrong direction πŸ˜‰

    What I have to 2 separate PHP apps: a WordPress blog, and TNG, which is a database for genealogical research. TNG is stand-alone, but I actually added menu entries in WordPress to particular views in TNG. (Next step is wrapping WordPress header.php and footer.php around TNG and customize CSS to make it a seamless thing.

    My issue is that I have 2 different apps with different searches. But I would indeed like to enter a search string into WordPress and see the results from both apps. Example: I enter the name of my grandpa, and I would like to yield articles where he is mentioned as well as the direct link to the TNG page with his personal record. (Plus maybe the link to the family record, when I learn how to add this)

    I was first thinking about forwarding the query string to the TNG query, receive these results and mix this back. But I did not find any reference how this could be done.

    My next idea is more “WordPress-ish”: creating a CPT and duplicate the entries from the other database into the WP database. This allows me to stay within WP only, for the price of redundant data. (Not to worry, just a few hundret records)
    I could e.g. use a certain helper script behind the scenes to read from TNG database and create records in WP database.

    Is this the way to go or is there even another scenario that I am not aware of?

    Sorry for the noise.

    Regards,
    Marcus

    #342726
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Great question, but a very complicated answer. You might have more luck getting an in-depth answer over here: https://wordpress.stackexchange.com/

    Let me know πŸ™‚

    #342793
    Marcus

    Hello Tom,

    I was making some progess with the “Pods” plugin.
    I created a CPT and the nice thing about Pods is that it allows easy templates for the display of the CPT posts.
    It works really great. The first result shown here [1] is the CPT I created.

    But I have an additional requirement related to your theme:
    I would like to change the link of the CPT that it does not point to the WordPress post itself, but to my external genealogy database. I found an article [2], but I cannot identify the mentioned code in your theme. I expected this in the search.php file.

    Where do I have to look?

    Thank you.

    [1] https://www.die-zurhorsts.de/?s=Mertesacker
    [2] http://www.wpbeginner.com/wp-tutorials/how-to-link-to-external-links-from-the-post-title-in-wordpress/

    #342933
    Tom
    Lead Developer
    Lead Developer

    What you would do is copy the content.php file and add it into your child theme. Then re-name is to content-search.php so it applies only to search results.

    Doing that will allow you to replace the_title() function with your own custom function.

    #342991
    Marcus

    Works perfect. Thank you.
    The link to https://www.die-zurhorsts.de/?s=Mertesacker yields an example CPT which directs now directly to the TNG site.

    Best regards,
    Marcus

    #343164
    Tom
    Lead Developer
    Lead Developer

    Awesome! πŸ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.