new logic banners
This commit is contained in:
@@ -1,24 +1,32 @@
|
||||
<?php
|
||||
|
||||
function number_info($title){
|
||||
function number_info($title, $post_id = 0){
|
||||
|
||||
$res = [];
|
||||
|
||||
$items = explode(' ', $title);
|
||||
$number = substr($items[2], 1, strlen($items[2]) - 2);
|
||||
//echo $number;
|
||||
|
||||
$res['year'] = $items[4];
|
||||
$res['number'] = $number;
|
||||
|
||||
$pdf_url = get_post_meta($post_id, '_pdf_file', true);
|
||||
if ($pdf_url) {
|
||||
$res['guid'] = esc_url($pdf_url);
|
||||
return $res;
|
||||
}
|
||||
|
||||
$number = substr($items[2], 1, strlen($items[2]) - 2);
|
||||
$name = 'vizh_'.$number.'_'.ru2enmonths($items[3]).'_'.$items[4];
|
||||
//echo '<p>'.$name.'</p>';
|
||||
|
||||
//echo '<p>'.$name.'</p>';
|
||||
|
||||
$findpdf = db_get("SELECT * FROM `wp_posts` WHERE `post_name` = '$name' ORDER BY `post_modified` DESC LIMIT 1");
|
||||
//echo "SELECT * FROM `wp_posts` WHERE `post_name` = '$name' ORDER BY `post_modified` DESC LIMIT 1";
|
||||
|
||||
|
||||
if (isset($findpdf['guid'])){
|
||||
$res['guid'] = $findpdf['guid'];
|
||||
$res['year'] = $items[4];
|
||||
$res['number'] = $number;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user