Support » Plugin: Relevanssi - A Better Search » Can Relevanssi index a custom post Pods auto template which uses a shortcode

  • Resolved mikeywil

    (@mikeywil)


    Sorry for the convolution here…

    I have a custom post type (made with Pods) called Journals – which is not excluded from search.
    I have another custom post type (Pod) called Articles – which is excluded from search because this only has a few fields.

    The Journals page uses a Pods Template which lays out the page with Journals fields at top of page, and then the Pods Template calls a Shortcode which displays all the Articles from that Journal. A bit like this:

    Journal Title - Journal date
    =============================
    Article 1 - page - author
    Article 2 - page - author
    Article 3 - page - author

    I have Relevanssi set to expand Shortcodes.

    Looking at the debugger for one of the Journal pages. , it seems to be only indexing the Journal fields and not the Articles (whose content appears on the Journal page via the shortcode).

    I’d like a search on ‘Article 1’ to find the relevant journal page, and exclude the Article 1 page.

    Any pointers?
    many thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter mikeywil

    (@mikeywil)

    FYI: I have just tried adding the filter described in these forums here but that doesn’t seem to have worked either.

    Plugin Author Mikko Saari

    (@msaari)

    Expanding shortcodes should do this if the shortcodes are built in the standard way, but with Pods it’s possible the shortcodes aren’t standard. I don’t know Pods, so I don’t know what it is doing if the shortcode isn’t being expanded – one explanation might be that the shortcode isn’t actually defined when Relevanssi would like to expand it.

    I’d probably do this with a relevanssi_content_to_index filter hook that on the Journal pages that would fetch all the articles related to the journal (if that information is somehow available) and then would read in the desired content from the article posts to the journal post.

    Thread Starter mikeywil

    (@mikeywil)

    Great support. I found that I could use the same shortcode in that filter hook.

    The shortcode creates an HTML table, so I cleaned this up a little, and then stored it (in a read-only field) as part of the Journal post content – as described in the section of your page (linked above) under “A note on performance”.

    Thanks very much.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can Relevanssi index a custom post Pods auto template which uses a shortcode’ is closed to new replies.