| Server IP : 89.248.107.232 / Your IP : 216.73.217.70 Web Server : Apache System : Linux host2.kasilh.com 5.14.0-687.36.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 7 05:40:49 EDT 2026 x86_64 User : seg ( 10005) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/seg-sa.es/grupo-seg.com/wp-content/plugins/ninja-tables/app/Traits/ |
Upload File : |
<?php
namespace NinjaTables\App\Traits;
trait WpPostTrait
{
public function wpInsertPost($postTitle)
{
$my_post = [
'post_title' => $postTitle,
'post_type' => 'ninja-table',
'post_status' => 'publish'
];
return wp_insert_post($my_post);
}
public function updatePostMeta($tableId, array $data)
{
update_post_meta($tableId, '_ninja_tables_data_provider', 'drag_and_drop');
update_post_meta($tableId, '_ninja_table_builder_table_html', $data['table_html']);
update_post_meta($tableId, '_ninja_table_builder_table_settings', $data['table_settings']);
update_post_meta($tableId, '_ninja_table_builder_table_responsive', $data['table_responsive']);
update_post_meta($tableId, '_ninja_table_builder_table_data', $data['table_data']);
}
public function wpUpdatePost($table_id, $postTitle)
{
$my_post = [
'ID' => $table_id,
'post_title' => $postTitle,
'post_type' => 'ninja-table',
'post_status' => 'publish'
];
return wp_update_post($my_post);
}
}