@@ 221-234 (lines=14) @@ | ||
218 | $filename = array_pop( $parts ); |
|
219 | $directory = $parts ? array_shift( $parts ) : ''; |
|
220 | ||
221 | if ( false !== strpos( $directory, 'post' ) ) { |
|
222 | preg_match( '/([0-9]{4})-([0-9]{2})-([0-9]{2})-(.*)\.md/', $filename, $matches ); |
|
223 | $title = $matches[4]; |
|
224 | ||
225 | $query = new WP_Query( array( |
|
226 | 'name' => $title, |
|
227 | 'posts_per_page' => 1, |
|
228 | 'post_type' => $this->get_whitelisted_post_types(), |
|
229 | 'fields' => 'ids', |
|
230 | ) ); |
|
231 | ||
232 | $post_id = $query->get_posts(); |
|
233 | $post_id = array_pop( $post_id ); |
|
234 | } |
|
235 | ||
236 | if ( ! $post_id ) { |
|
237 | preg_match( '/(.*)\.md/', $filename, $matches ); |
|
@@ 236-249 (lines=14) @@ | ||
233 | $post_id = array_pop( $post_id ); |
|
234 | } |
|
235 | ||
236 | if ( ! $post_id ) { |
|
237 | preg_match( '/(.*)\.md/', $filename, $matches ); |
|
238 | $title = $matches[1]; |
|
239 | ||
240 | $query = new WP_Query( array( |
|
241 | 'name' => $title, |
|
242 | 'posts_per_page' => 1, |
|
243 | 'post_type' => $this->get_whitelisted_post_types(), |
|
244 | 'fields' => 'ids', |
|
245 | ) ); |
|
246 | ||
247 | $post_id = $query->get_posts(); |
|
248 | $post_id = array_pop( $post_id ); |
|
249 | } |
|
250 | } |
|
251 | ||
252 | if ( ! $post_id ) { |