Add-on to another plugin doesn't work – urgent :(
-
Hi,
first: thank you for the plugin, it’s awesome!I have a problem implementing it with another plugin: tablepress.
What do I want to do?
– I fill tables with polylang strings (ex: hello-world)
– I apply a filter before tablepress print which capture cell content and find proper translate
– It returns the translated terms instad of string-keyword (ex: en -> ‘Hello World’, it -> ‘Ciao Mondo’, etc.)I already prepared the plugin, which was pretty simple:
function tablepress_translate_in_cells( $cell_content, $table_id, $lang ) {
if (!(isset($lang)) || $lang==”)
$lang = pll_current_language();
return pll_translate_string($cell_content, $lang);
}Then in template (page.php) BEFORE printing the_content I call it:
add_filter( ‘tablepress_cell_content’, ‘tablepress_translate_in_cells’, pll_current_language() );Here I have the problem: if I’m logged in, it works properly. If I’m not, polylang functions doesn’t have proper calls in tablepress_translate_in_cells.
I should publish this site tomorrow, I saw the error only for luck because I was always logged in wp-admin panel ?? Please help!
EDIT: I guess I just need to simulate every user is logged or find how to initialize manually polylang as they were
- The topic ‘Add-on to another plugin doesn't work – urgent :(’ is closed to new replies.