コード例 #1
0
<?php

if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
//single page titile
$titleShow = get_post_meta(OT_page_id(), THEME_NAME . "_title_show", true);
$post_type = get_post_type();
?>
					

<?php 
if ($titleShow != "no") {
    ?>
 
	<div class="main-head">
		<?php 
    if (is_single() && $post_type == OT_POST_MENU) {
        ?>
			<?php 
        $menuID = ot_get_page("menu-card");
        $title = get_the_title($menuID[0]);
        ?>
			<a href="<?php 
        echo get_page_link(ot_get_page('menu-card', false));
        ?>
" class="right"><?php 
        _e("back to Menu Card", THEME_NAME);
        ?>
</a>
コード例 #2
0
ファイル: other.php プロジェクト: trantuanvn/coffeeletsgo
function ot_page_title()
{
    $post_type = get_post_type();
    if (!is_archive() && !is_category() && !is_search() && $post_type != OT_POST_GALLERY) {
        $title = get_the_title(OT_page_id());
    } else {
        if (is_single() && $post_type == OT_POST_GALLERY) {
            $galID = ot_get_page("gallery");
            $title = get_the_title($galID[0]);
        } else {
            if (is_search()) {
                $title = __("Search Results for", THEME_NAME) . " \"" . remove_html($_GET['s']) . "\"";
            } else {
                if (is_category()) {
                    $category = get_category(get_query_var('cat'));
                    $cat_id = $category->cat_ID;
                    $catName = get_category($cat_id)->name;
                    $title = $catName;
                } else {
                    if (is_author()) {
                        $curauth = get_query_var('author_name') ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
                        $title = __("Posts From", THEME_NAME) . " " . $curauth->display_name;
                    } else {
                        if (is_tag()) {
                            $category = single_tag_title('', false);
                            $title = __("Tag", THEME_NAME) . " \"" . $category . "\"";
                        } else {
                            if (is_archive()) {
                                if (ot_is_woocommerce_activated() == true && woocommerce_get_page_id('shop') == OT_page_id()) {
                                    $title = get_the_title(OT_page_id());
                                } else {
                                    $title = __("Archive", THEME_NAME);
                                }
                            } else {
                                $title = get_the_title(OT_page_id());
                            }
                        }
                    }
                }
            }
        }
    }
    echo $title;
}