Example #1
0
function get_static_file_path()
{
    $filepath = get_req_path();
    $page_path = get_template_directory() . '/pages/' . $filepath . '.php';
    return $page_path;
}
function get_head_meta($name = null)
{
    global $_SITE;
    global $_PAGES;
    global $_SINGLE_POSTS;
    if ($name == 'author') {
        return $_SITE['author'];
    }
    if (is_home()) {
        $meta = array('title' => $_SITE['title'], 'url' => get_sitepath('url') . '/' . get_req_path(), 'description' => $_SITE['description'], 'image' => $_SITE['image'], 'type' => 'website');
    } else {
        if (is_single()) {
            $p = $_SINGLE_POSTS[get_page_file()][get_page_slug()];
            $meta = array('title' => $p['title'] . ' | ' . $_SITE['title'], 'url' => get_sitepath('url') . '/' . get_req_path(), 'description' => $p['description'], 'image' => $p['image'], 'type' => 'article');
        } else {
            if (is_page()) {
                $p = $_PAGES[get_page_slug()];
                $image = !empty($p['image']) ? $p['image'] : $_SITE['image'];
                $desc = !empty($p['description']) ? $p['description'] : $_SITE['description'];
                $meta = array('title' => $p['title'] . ' | ' . $_SITE['title'], 'url' => get_sitepath('url') . '/' . get_req_path(), 'description' => $desc, 'image' => $image, 'type' => 'article');
            } else {
                $meta = array('title' => $_SITE['title'], 'url' => get_sitepath('url') . '/' . get_req_path(), 'description' => $_SITE['description'], 'image' => $_SITE['image'], 'type' => 'article');
            }
        }
    }
    $meta = array_merge($_SITE, $meta);
    return isset($name) && isset($meta[$name]) ? $meta[$name] : $meta;
}