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.
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.
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.
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.
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.
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.
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.
The “relevanssi_post_content” hook does not execute while rebuilding the index.
It certainly should, unless you’ve disabled post content indexing. It’s applied inside relevanssi_index_content()
, which runs whenever post content is indexed.
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.
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.
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.
ok, thank’s anyway, i will contact themeco
After contacting themeco it should be the apply_filters function.
but i still not get the “relevanssi_post_content” filter to work.
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?