• Resolved Cliff

    (@drrichbunk)


    I have a site that is in development that uses the Divi Visual Builder as well as Pods shortcodes for dynamic content.

    At this point Relevanssi works correctly in the following situations:
    – On Gutenberg pages that have dynamic Pods content
    – On pages created using Divi Visual Builder

    Unfortunately it doesn’t work on pages created using Divi Visual Builder that have dynamic Pods content.

    I have the “Expand Shortcodes” option clicked on, but that doesn’t make a difference. Is the problem that the Divi Builder content is made of shortcodes and then the Pods content is a shortcode within those shortcodes?

    Please let me know if there’s anything you can recommend I try. Thanks!

    • This topic was modified 2 years, 5 months ago by Cliff.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Having shortcodes inside shortcodes may or may not be a problem. Relevanssi runs the content through do_shortcode(), which should expand all shortcodes inside the content, even nested shortcodes.

    The relevanssi_post_content_after_shortcodes filter hook filters the post content right after Relevanssi runs do_shortcode(). What does the content look like at that point?

    Thread Starter Cliff

    (@drrichbunk)

    Here’s what the the content looks like at the point of relevanssi_post_content_after_shortcodes:

    (I output this to the using the error_log function. I’m redacting some content to keep the project private.)

    [22-Jun-2022 05:09:23] WARNING: child 4377 said into stderr: "NOTICE: PHP message:       <p>With a mission to foster.</p>"
    [22-Jun-2022 05:09:23] WARNING: child 4377 said into stderr: "<p>Embracing the collaboration. </p>             <h2>Want to Learn more?</h2>      "

    There are two Divi Code modules each with a Pods shortcodes between the last </p> and the <h2> which aren’t showing up. But this is where the plot thickens because there’s also a hardcoded <h4> in those code modules which isn’t part of the Pods shortcode and that’s also not showing up.

    Here’s what the code inside the Divi Code module looks like:

    <h4>
      Committee Chair
    </h4>
    <div class="people-list">
    [pods name="person" where="rel_committee_chair_of.post_title = 'Some Committee'" template="List of People - Committee Chairs"][/pods]
    </div>

    Seeing that the <h4>Committee Chair</h4> text didn’t show up in the indexing, it looks like the problem is actually with the Divi Code module and not the processing of the Pods shortcodes.

    In fact I confirmed this by putting the Pods shortcode inside a Divi Text module, and when I did that, Relevanssi indexed it correctly.

    So whatever Divi is doing with their Code module is preventing Relevanssi from seeing content in there. For my purposes, my problem is essentially solved. I don’t need to use the Code module to insert shortcodes; I can just change all of the shortcodes to use a Text module instead. But this is probably something you will want to look into to see if there is a way for Relevanssi to index content inside of the Divi Code module.

    Thanks for your help in sorting this out. I wouldn’t have figured it out without the clues from the relevanssi_post_content_after_shortcodes function.

    Plugin Author Mikko Saari

    (@msaari)

    Is the Divi Code module shortcode [et_pb_code]? Relevanssi removes the [et_pb_code] shortcode and its contents in the indexing on purpose. I don’t remember what the exact reason is; it may be Divi encodes the code shortcode contents or something like that.

    You can change the Relevanssi behaviour using the relevanssi_page_builder_shortcodes filter hook, to keep the [et_pb_code] shortcode contents intact – but this may or may not help, I’m not sure. Using a different module in Divi is a guaranteed fix for this.

    Thread Starter Cliff

    (@drrichbunk)

    Yes, the Divi Code module is et_pb_code. According to the Divi site, the Code module is intended for how I’m using it: “a blank canvas that allows you to add code to your page, such as plugin shortcodes or static HTML” (https://www.elegantthemes.com/documentation/divi/code/)

    Functionally it seems very similar to the Gutenberg Custom HTML block. In both cases you can add HTML, shortcodes, and run some simple javascript/jQuery inside of <script> tags.

    Does Relevanssi remove the Gutenberg Custom HTML block?

    I’ll give the relevanssi_page_builder_shortcodes a try and see if that works.

    Thread Starter Cliff

    (@drrichbunk)

    I’m not sure what’s going on in the et_pb_code, but you have good reason to remove it from the index. After using the relevanssi_page_builder_shortcodes filter to allow all et_pb_code content through, the indexing failed every time.

    I’ll go back to the initial plan of using the et_pb_text module for any shortcode content that I need indexed.

    Thanks again for your help with this!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Not indexing Pods shortcode content on Divi pages’ is closed to new replies.