• Resolved regnalf

    (@regnalf)


    I would like to use Relevanssi on one of my pages because it also searches shortcodes.

    The theme pro (from ThemeCo) which I mainly use generates more dynamic content using custom shortcodes like {{dc:post:title}}, which displays the title of the post.

    Would it be possible to search the complete parsed content?

    Also, the search behaves strangely when you are logged in or not. It even redirects to the home page instead of showing “No search term found”.

Viewing 15 replies - 1 through 15 (of 47 total)
  • Plugin Author Mikko Saari

    (@msaari)

    I’m not sure, it depends on how these are implemented. It is possible they will work automatically, being replaced with the current value at the moment of indexing. The ThemeCo documentation doesn’t really explain how this all works, so I don’t know. The only way to find out is to give it a go.

    If it does not work automatically, then the next step would be to write to ThemeCo support and ask them for a method of converting the dynamic content shortcodes to their actual values. If there’s a way to do that, then it’ll be no problem to make Relevanssi read them.

    Thread Starter regnalf

    (@regnalf)

    One way I see is to index the content using fully parsed content with the_content().

    I tested this with a shortcode that reads the page using WP_Query and outputs the content using the_content(). Then all shortcodes and pro content {{}} are parsed.

    Plugin Author Mikko Saari

    (@msaari)

    In that case it should not be a problem, Relevanssi does apply the_content filters on the content before it is indexed. If that’s what the ThemeCo themes use, then it’ll be fine.

    Thread Starter regnalf

    (@regnalf)

    Ok, but then i’ll wondering while i still miss some search results from pages :-/
    I’m talking about normal post pages, not custom types.

    Even the debug info of that specific site shows that the word i’ve searching is not indexed.

    Plugin Author Mikko Saari

    (@msaari)

    I can’t really tell, because I don’t know how the theme works. You can check with the Relevanssi debugger: check a post and see if Relevanssi sees the dynamic content or not, the words in the dynamic content should appear in the debugger.

    If they appear there, the dynamic content works, but if they don’t, then the dynamic content does not get expanded. In order to help you further with this, I’d need some information on how the theme actually expands the shortcodes, is it done with a the_content filter hook or something else. ThemeCo support can answer that question, I can’t.

    Thread Starter regnalf

    (@regnalf)

    I’ve testet it with the debugger, but the term i’m looking for is not in the index on this page. However, the function the_content() parse the pro theme tags, i’ve tested before in a shortcode.

    Plugin Author Mikko Saari

    (@msaari)

    Hmm, actually, Relevanssi only runs the_content in excerpt-building, not in indexing. Try this in your theme functions.php:

    add_filter( 'relevanssi_post_content', 'rlv_apply_the_content' );
    function rlv_apply_the_content( $content ) {
      return apply_filters( 'the_content', $content );
    }

    This should expand the shortcodes.

    Thread Starter regnalf

    (@regnalf)

    The “relevanssi_post_content” hook does not execute while rebuilding the index.

    Plugin Author Mikko Saari

    (@msaari)

    It certainly should, unless you’ve disabled post content indexing. It’s applied inside relevanssi_index_content(), which runs whenever post content is indexed.

    Thread Starter regnalf

    (@regnalf)

    No, i use allmost the standard settings after installation.
    Post and pages are set to indexing.

    Maybe you will have a closer look, the site is still under construction. I can send you login credentials if you wish.

    Thread Starter regnalf

    (@regnalf)

    Maybe one hint, the_content() function worked only if i was get the post via WP_Query and then in the looper i used the_content() function. Only there it worked.

    If i used the get_post() function and apply filter, it doesn’t, don’t know why.

    Plugin Author Mikko Saari

    (@msaari)

    I can’t take a look at your site; I’m not allowed to ask for login credentials here, that’s a serious offense, and anyway it’s a service I can only provide for paying Relevanssi Premium customers.

    The experience you’ve had would suggest the shortcodes are not always active. I would recommend writing to ThemeCo support and asking them about this.

    Thread Starter regnalf

    (@regnalf)

    ok, thank’s anyway, i will contact themeco

    Thread Starter regnalf

    (@regnalf)

    After contacting themeco it should be the apply_filters function.

    but i still not get the “relevanssi_post_content” filter to work.

    Plugin Author Mikko Saari

    (@msaari)

    There’s a bigger problem if the relevanssi_post_content filter doesn’t fire at all. It definitely should for every post.

    Does the relevanssi_do_not_index filter hook work?

Viewing 15 replies - 1 through 15 (of 47 total)
  • The topic ‘Dynamic Content with theme pro’ is closed to new replies.