This hook allows to extend tables columns or change already existed ones.
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | //lets add button to the table with contact form in iframe. Contact form provided by another pl. add_action('tableon_profile_extend', function($profile, $action_name) { if ($action_name === 'tableon_default_tables') { $profile['ask_me'] = [ 'title' => esc_html('Ask Me'), 'order' => FALSE, 'action' => function($post_id) { return TABLEON_HELPER::draw_html_item('a', [ 'href' => 'javascript: new Popup23({iframe:"SITE_LINK_HERE", allow:"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"});void(0);', 'class' => 'tableon-btn' ], esc_html('Ask Me')); } ]; } return $profile; }, 10, 2); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | //changing already existed META column __sale add_action('tableon_profile_extend', function($profile, $action_name) { if ($action_name === 'tableon_default_tables') { $profile['__sale']['action'] = function($post_id) { $post = TABLEON_Default::get_post($post_id); if (is_object($post)) { return get_post_meta($post_id, '__sale', true) ? "<span class=''>Yes</span>" : "<span class='tableon-html-cross2'>No</span>"; } }; } return $profile; }, 10, 2); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | //lets add referral button to the table add_action('tableon_profile_extend', function($profile, $action_name) { if ($action_name === 'tableon_default_tables') { $profile['refferals'] = [ 'title' => 'Refferal btn', 'order' => FALSE, 'action' => function($post_id) { $refferal = 'demo'; $link_data = TABLEON_HELPER::get_link_data(); if (isset($link_data['tableon_refferal'])) { $refferal = $link_data['tableon_refferal']; } return TABLEON_HELPER::draw_html_item('a', [ 'href' => "https://demo.posts-table.com?ref={$refferal}&post_id={$post_id}", 'class' => 'tableon-btn', 'target' => '_blank' ], 'Get it for free'); } ]; } return $profile; }, 10, 2); |
Make your attention to link param 'tableon_refferal', using prefix 'tableon_' it is possible to transmit different data, for example 'tableon_id=77&tableon_any_param=asdfgh'