PluginProbe
Export All Posts, Products, Orders & Users | WP Ultimate Exporter | WordPress CSV Export / trunk
Export All Posts, Products, Orders & Users | WP Ultimate Exporter | WordPress CSV Export vtrunk
3.0 2.24.2 2.24.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 2.0 2.0.1 2.1 2.1.1 2.1.2 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.16.1 2.16.2 All 96 releases
wp-ultimate-exporter / exportExtensions / ElementorExport.php

ElementorExport.php in Export All Posts, Products, Orders & Users | WP Ultimate Exporter | WordPress CSV Export trunk, at exportExtensions/ElementorExport.php

64 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /******************************************************************************************
3 * Copyright (C) Smackcoders. - All Rights Reserved under Smackcoders Proprietary License
4 * Unauthorized copying of this file, via any medium is strictly prohibited
5 * Proprietary and confidential
6 * You can contact Smackcoders at email address info@smackcoders.com.
7 *******************************************************************************************/
8 namespace Smackcoders\SMEXP;
9
10 if ( ! defined( 'ABSPATH' ) )
11 exit; // Exit if accessed directly
12
13 class ElementorExport {
14
15 public function __construct() {
16 $this->templateExport();
17 }
18
19 public function templateExport() {
20 global $wpdb;
21 $args = [
22 'post_type' => 'elementor_library',
23 'posts_per_page' => -1,
24 ];
25 $query = new \WP_Query($args);
26 $templates = $query->get_posts();
27 $output = [];
28 $headers = ["ID", "Template title", "Template content", "Style" ,"Template type", "Created time",
29 "Created by", "Template status","Category"];
30 foreach ($templates as $template) {
31 $styles = get_post_meta($template->ID, '_elementor_data', true);
32 $styles_decode = json_decode($styles, true);
33 $serialize_style = serialize($styles_decode);
34 $encode_style = serialize($serialize_style);
35 $encode_style = serialize($encode_style);
36 $json_string = serialize([
37 'content' => $template->post_content,
38 ]);
39 $json_strings = serialize($json_string);
40 $author_data = get_userdata($template->post_author);
41 $categories = get_the_terms($template->ID, 'elementor_library_category'); // Replace 'elementor_library_category' with the correct taxonomy name
42
43 $category_names = [];
44 if (!empty($categories)) {
45 foreach ($categories as $category) {
46 $category_names[] = $category->name;
47 }
48 }
49
50 $output[] = [
51 'ID' => $template->ID,
52 'Template title' => $template->post_title,
53 'Template content' => $json_strings,
54 'Style' => $encode_style,
55 'Template type' => get_post_meta($template->ID,'_elementor_template_type', true),
56 'Created time' => $template->post_date,
57 'Created by' => $author_data->display_name,
58 'Template status' => $template->post_status,
59 'Category' => implode(', ', $category_names),
60 ];
61 }
62 return $output;
63 }
64 }