• Resolved Lo?c Parent

    (@lowick)


    Hello,

    Is there a way to change php content (apply function etc) before render the table in the front page ?

    I would like to change some content using RegEx but I need to get the content in array before showing the table in the page.

    Thanks for your help and have a good day.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    For this, I recommend to use the filter hooks that are provided in the class-render.php file, like tablepress_table_render_data, see https://github.com/TobiasBg/TablePress/blob/master/classes/class-render.php#L258

    Regards,
    Tobias

    Thread Starter Lo?c Parent

    (@lowick)

    Hi Tobias,

    Thanks for your answer !

    Ok, I’ll try this

    Thanks,
    Lo?c.

    Thread Starter Lo?c Parent

    (@lowick)

    Hi again,

    I just tried with the filter tablepress_table_render_data but nothing happened.
    I try to put a die(); inside the function but nothing change and the table appear correctly.

    Here is the function I use for example :

    
    function my_function( $table, $orig_table, $render_options ) {
        
        die('stop');
    
        return $table;
    }
    add_filter( 'tablepress_table_render_data', 'my_function' );
    

    Do you have an idea where the problem is coming from ?

    Thanks for your help.
    Lo?c.

    • This reply was modified 6 years, 7 months ago by Lo?c Parent.
    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    you are probably seeing the cached version.

    First, change

    add_filter( 'tablepress_table_render_data', 'my_function' );
    

    to

    add_filter( 'tablepress_table_render_data', 'my_function', 10, 3 );
    

    Then, please add the Shortcode parameter cache_table_output=false to the Shortcode on the page where you are showing the table.

    Regards,
    Tobias

    Thread Starter Lo?c Parent

    (@lowick)

    Ok it works perfectly now, thank you !

    Yes, I didn’t set the cache_table_output to false

    Thanks for your help.

    Regards,
    Lo?c.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add change with PHP before render the table in front’ is closed to new replies.