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