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