@@ -79,8 +79,6 @@ public function execute()
79
79
$ ct ->setPath (
80
80
$ parentId = $ oldCategories [$ oldParentId ]->getId ()
81
81
);
82
-
83
- echo 'set path: ' .$ parentId .'<br/> ' ;
84
82
}
85
83
}
86
84
}
@@ -130,6 +128,38 @@ public function execute()
130
128
}
131
129
}
132
130
131
+ $ data ['featured_img ' ] = '' ;
132
+
133
+ $ sql = 'SELECT wm2.meta_value as featured_img
134
+ FROM
135
+ ' .$ _pref .'posts p1
136
+ LEFT JOIN
137
+ ' .$ _pref .'postmeta wm1
138
+ ON (
139
+ wm1.post_id = p1.id
140
+ AND wm1.meta_value IS NOT NULL
141
+ AND wm1.meta_key = "_thumbnail_id"
142
+ )
143
+ LEFT JOIN
144
+ wp_postmeta wm2
145
+ ON (
146
+ wm1.meta_value = wm2.post_id
147
+ AND wm2.meta_key = "_wp_attached_file"
148
+ AND wm2.meta_value IS NOT NULL
149
+ )
150
+ WHERE
151
+ p1.ID=" ' .$ data ['ID ' ].'"
152
+ AND p1.post_type="post"
153
+ ORDER BY
154
+ p1.post_date DESC ' ;
155
+
156
+ $ result2 = $ this ->_mysqliQuery ($ sql );
157
+ if ($ data2 = mysqli_fetch_assoc ($ result2 )) {
158
+ if ($ data2 ['featured_img ' ]) {
159
+ $ data ['featured_img ' ] = \Magefan \Blog \Model \Post::BASE_MEDIA_PATH . '/ ' . $ data2 ['featured_img ' ];
160
+ }
161
+ }
162
+
133
163
/* Prepare post data */
134
164
foreach (['post_title ' , 'post_name ' , 'post_content ' ] as $ key ) {
135
165
$ data [$ key ] = utf8_encode ($ data [$ key ]);
@@ -149,6 +179,7 @@ public function execute()
149
179
'publish_time ' => $ creationTime ,
150
180
'is_active ' => (int )($ data ['post_status ' ] == 'publish ' ),
151
181
'categories ' => $ postCategories ,
182
+ 'featured_img ' => $ data ['featured_img ' ],
152
183
];
153
184
$ data ['identifier ' ] = trim (strtolower ($ data ['identifier ' ]));
154
185
if (strlen ($ data ['identifier ' ]) == 1 ) {
0 commit comments