Пример #1
0
 function getTemplatePageId($name)
 {
     $posts = getPostsByMetaValue('_wp_page_template', $name . '.php', ARRAY_A);
     $id = 0;
     for ($i = 0; $i < count($posts); $i++) {
         if ($posts[$i]['post_status'] == 'publish') {
             $id = $posts[$i]['post_id'];
             break;
         }
     }
     return $id;
 }
Пример #2
0
function getTemplatePageId($name)
{
    $posts = getPostsByMetaValue('_wp_page_template', $name . '.php', ARRAY_A);
    return count($posts) > 0 ? $posts[0]['post_id'] : 0;
}