@@ 253-266 (lines=14) @@ | ||
250 | $filename = array_pop( $parts ); |
|
251 | $directory = $parts ? array_shift( $parts ) : ''; |
|
252 | ||
253 | if ( false !== strpos( $directory, 'post' ) ) { |
|
254 | preg_match( '/([0-9]{4})-([0-9]{2})-([0-9]{2})-(.*)\.md/', $filename, $matches ); |
|
255 | $title = $matches[4]; |
|
256 | ||
257 | $query = new WP_Query( array( |
|
258 | 'name' => $title, |
|
259 | 'posts_per_page' => 1, |
|
260 | 'post_type' => $this->get_whitelisted_post_types(), |
|
261 | 'fields' => 'ids', |
|
262 | ) ); |
|
263 | ||
264 | $post_id = $query->get_posts(); |
|
265 | $post_id = array_pop( $post_id ); |
|
266 | } |
|
267 | ||
268 | if ( ! $post_id ) { |
|
269 | preg_match( '/(.*)\.md/', $filename, $matches ); |
|
@@ 268-281 (lines=14) @@ | ||
265 | $post_id = array_pop( $post_id ); |
|
266 | } |
|
267 | ||
268 | if ( ! $post_id ) { |
|
269 | preg_match( '/(.*)\.md/', $filename, $matches ); |
|
270 | $title = $matches[1]; |
|
271 | ||
272 | $query = new WP_Query( array( |
|
273 | 'name' => $title, |
|
274 | 'posts_per_page' => 1, |
|
275 | 'post_type' => $this->get_whitelisted_post_types(), |
|
276 | 'fields' => 'ids', |
|
277 | ) ); |
|
278 | ||
279 | $post_id = $query->get_posts(); |
|
280 | $post_id = array_pop( $post_id ); |
|
281 | } |
|
282 | } |
|
283 | ||
284 | if ( ! $post_id ) { |