Example #1
0
function get_archive_title()
{
    $title = "";
    $page_title = \get_the_archive_title();
    if (\is_category()) {
        //カテゴリーページ
        $title = "『{$page_title』カテゴリーの記事}";
    } elseif (\is_tag()) {
        //タグページ
        $title = "『{$page_title』タグが付けられた記事}";
    } elseif (\is_tax()) {
        //タクソノミーページ
        $title = "『{$page_title』に分類された記事}";
    } elseif (\is_author()) {
        //作成者ページ
        $title = "『{$page_title』が作成した記事}";
    } elseif (\is_year() || \is_month() || \is_date()) {
        //年
        $title = "{$page_titleに作成された記事}";
    } else {
        //不明なアーカイブ
        $title = $page_title;
    }
    return $title;
}
    public function opengraph()
    {
        $tags = [];
        if (is_singular()) {
            $tags['og:title'] = get_the_title();
        } elseif (is_archive()) {
            $tags['og:title'] = get_the_archive_title();
        }
        if (is_singular()) {
            $tags['og:description'] = get_the_excerpt();
        }
        if (is_singular()) {
            $tags['og:url'] = get_permalink();
        } elseif (is_tax()) {
            $tags['og:url'] = get_term_link(get_queried_object(), get_queried_object()->taxonomy);
        }
        if (is_singular() && has_post_thumbnail()) {
            $tags['og:image'] = get_the_post_thumbnail_url('full');
        }
        $tags = wp_parse_args($tags, ['og:type' => 'website', 'og:title' => get_bloginfo('name'), 'og:description' => get_bloginfo('description'), 'og:url' => home_url('/'), 'og:image' => get_site_icon_url()]);
        $tags = array_filter($tags);
        $tags = apply_filters('opengraph_tags', $tags);
        foreach ($tags as $property => $content) {
            printf('
			<meta property="%s" content="%s">', esc_attr($property), esc_attr($content));
        }
    }
function zn_sensei_before_main_content()
{
    $args = array();
    if (!is_single()) {
        // SHOW THE HEADER
        if (empty($args['title'])) {
            //** Put the header with title and breadcrumb
            $args['title'] = __('Courses', 'zn_framework');
        }
        if (is_tax()) {
            $args['title'] = get_the_archive_title();
            $args['subtitle'] = '';
            // Reset the subtitle for categories and tags
        }
    }
    WpkPageHelper::zn_get_subheader($args);
    global $zn_config;
    $zn_config['force_sidebar'] = 'blog_sidebar';
    $main_class = zn_get_sidebar_class('blog_sidebar');
    if (strpos($main_class, 'right_sidebar') !== false || strpos($main_class, 'left_sidebar') !== false) {
        $zn_config['sidebar'] = true;
    } else {
        $zn_config['sidebar'] = false;
    }
    $zn_config['size'] = $zn_config['sidebar'] ? 'col-sm-9' : 'col-sm-12';
    ?>
	<section id="content" class="site-content shop_page">
		<div class="container">
			<div class="row">
				<div class="<?php 
    echo $main_class;
    ?>
">
	<?php 
}
Example #4
0
 /**
  * Display the archive title based on the queried object.
  *
  * @since 1.0.0
  *
  * @see get_the_archive_title()
  *
  * @param string $before Optional. Content to prepend to the title. Default empty.
  * @param string $after  Optional. Content to append to the title. Default empty.
  */
 function the_archive_title($before = '', $after = '')
 {
     $title = get_the_archive_title();
     if (!empty($title)) {
         echo $before . $title . $after;
     }
 }
 /**
  * get_page_title
  *
  * @return string|void
  */
 protected function get_page_title()
 {
     if (empty($this->page_title)) {
         $this->page_title = get_the_archive_title();
     }
     return $this->page_title;
 }
Example #6
0
 /**
  * Determine the context that will be used by the content() method
  */
 public function context()
 {
     global $wp_query;
     $context = Maera()->cache->get_context();
     $post = new TimberPost();
     $context['post'] = $post;
     $context['posts'] = Timber::get_posts();
     // Compatibility hack or plugins that change the content.
     if ($this->plugins_compatibility()) {
         $context['content'] = maera_get_echo('the_content');
     }
     if (is_singular()) {
         $context['wp_title'] .= ' - ' . $post->title();
     }
     if (is_search()) {
         $context['title'] = __('Search results for ', 'maera') . get_search_query();
     }
     if (is_archive() || is_home()) {
         $context['posts'] = Timber::query_posts(false, 'TimberPost');
         $context['title'] = get_the_archive_title();
         if (is_author()) {
             $author = new TimberUser($wp_query->query_vars['author']);
             $context['author'] = $author;
         }
     }
     if (class_exists('WooCommerce')) {
         global $product;
         $context['product'] = $product;
     }
     return $context;
 }
Example #7
0
/**
 * Page titles
 */
function title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Latest Posts', 'sage');
        }
    } elseif (is_front_page()) {
        return "<span>Lemon Tree Trust Homepage</span>";
    } elseif (is_archive()) {
        return get_the_archive_title();
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'sage'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'sage');
    } elseif (is_page()) {
        $full = get_the_title();
        if (has_post_thumbnail($post->ID)) {
            $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail');
            //echo $image[0];
            echo "<div id='custom-bg' style='background-image: url(" . $image[0] . ")' > <div class='desc page_title'>";
            echo '<h2>' . get_the_title() . '</h2></div> </div>';
        }
        //return $full;
    } else {
        return get_the_title();
    }
}
/**
 * Gets the current page title.
 *
 * @since 1.3.0
 *
 * @param bool|string $title Page title override.
 *
 * @returns string The title.
 */
function jc_get_page_title($title = false)
{
    if ($title !== false) {
        $page_title = $title;
    } else {
        if (is_search()) {
            $page_title = 'Search';
        } elseif (is_404()) {
            $page_title = '404';
        } elseif (is_archive()) {
            $page_title = get_the_archive_title();
        } else {
            $page_title = get_the_title(get_top_parent_page_id());
        }
    }
    /**
     * Filters the main (burgundy bar) page title.
     *
     * @since 0.4.0
     * @hooked
     *
     * @param string $page_title The page title.
     */
    echo apply_filters('jc_page_title', $page_title);
}
Example #9
0
function fp_get_archive_title($pt)
{
    $title = fp_get_archive_field($pt, '_title');
    if (!$title) {
        $title = get_the_archive_title();
    }
    return $title;
}
Example #10
0
/**
 * Archive title
 *
 * Displays the title for archive pages.
 *
 * @since 1.0.0
 * @see https://developer.wordpress.org/reference/functions/the_archive_title/
 */
function portland_archive_title()
{
    $portland_archive_title = get_the_archive_title();
    if ('Archives' != $portland_archive_title) {
        echo '<h1 class="page-title">' . $portland_archive_title . '</h1>';
    }
    the_archive_description('<p class="page-description">', '</p>');
}
Example #11
0
/**
 * Echo archive post title.
 *
 * @since 1.4.0
 */
function beans_post_archive_title()
{
    if (!is_archive()) {
        return;
    }
    beans_open_markup_e('beans_archive_title', 'h1', array('class' => 'uk-article-title'));
    beans_output_e('beans_archive_title_text', get_the_archive_title());
    beans_close_markup_e('beans_archive_title', 'h1');
}
Example #12
0
 /**
  * Site title.
  *
  * @since 1.0.0
  */
 function satu_page_title()
 {
     if (is_singular()) {
         echo '<h1 class="post-title page-title" itemprop="headline">' . esc_attr(get_the_title()) . '</h1>';
     } elseif (is_archive()) {
         echo '<h1 class="archive-title page-title" itemprop="headline">' . get_the_archive_title() . '</h1>';
     } elseif (is_search()) {
         echo '<h1 class="page-title">' . sprintf(esc_html__('Search Results for: %s', 'satu'), '<span class="result">' . get_search_query() . '</span>') . '</h1>';
     } elseif (is_404()) {
         echo '<h1 class="page-title">' . esc_html__('Oops! That page can&rsquo;t be found.', 'satu') . '</h1>';
     } else {
         echo '<h1 class="site-title"><a href="' . esc_url(get_home_url()) . '" itemprop="url" rel="home"><span itemprop="headline">' . esc_attr(get_bloginfo('name')) . '</span></a></h1>';
     }
 }
Example #13
0
 public function get_title()
 {
     $separator = $this->title_separator;
     $use_wp_title = $this->use_wp_title_function;
     // Disabling 'title-tag' feature.
     $activate_title_tag_back = false;
     if ($use_wp_title && get_theme_support('title-tag')) {
         remove_theme_support('title-tag');
         $activate_title_tag_back = true;
     }
     $q = $GLOBALS['wp_query'];
     if ($q->get('wc_query') && function_exists('woocommerce_page_title')) {
         if ($separator) {
             $separator = '';
         }
         $title = woocommerce_page_title(false);
     } else {
         $is_home = is_home();
         $is_front_page = is_front_page();
         if ($is_home || $is_front_page) {
             if ($is_home && $is_front_page) {
                 $title = get_bloginfo('name');
             } elseif ($is_home) {
                 $title = get_the_title(get_option('page_for_posts'));
             } elseif ($is_front_page) {
                 $title = get_the_title(get_option('page_on_front'));
             }
         } else {
             if ($use_wp_title) {
                 $title = wp_title($separator, false);
             } else {
                 $title = is_singular() ? get_the_title(get_queried_object()) : strip_tags(get_the_archive_title());
             }
         }
     }
     // Restoring 'title-tag' feature.
     if ($activate_title_tag_back) {
         // add_theme_support( 'title-tag' );
         $GLOBALS['_wp_theme_features']['title-tag'] = true;
     }
     if ($title) {
         if ($separator) {
             $title = substr($title, strlen($separator) + 1);
         }
         $title = trim($title);
     }
     return $title;
 }
Example #14
0
function title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        }
        return 'Últimos posts';
    } elseif (is_archive()) {
        return get_the_archive_title();
    } elseif (is_search()) {
        return sprintf('Resultado da pesquisa para %s', get_search_query());
    } elseif (is_404()) {
        return 'Nada encontrado';
    }
    return get_the_title();
}
Example #15
0
/**
 * Page titles
 */
function title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
        }
    } elseif (is_archive()) {
        return get_the_archive_title();
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'sage'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'sage');
    } else {
        return get_the_title();
    }
}
Example #16
0
/**
 * Page titles
 */
function title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Ultimi post', 'sage');
        }
    } elseif (is_archive()) {
        return get_the_archive_title();
    } elseif (is_search()) {
        return sprintf(__('Risultati di ricerca per %s', 'sage'), get_search_query());
    } elseif (is_404()) {
        return __('Collegamento non trovato', 'sage');
    } else {
        return get_the_title();
    }
}
Example #17
0
/**
 * Page titles
 */
function xt_corporate_lite_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Latest Posts', 'xt-corporate-lite');
        }
    } elseif (is_archive()) {
        return get_the_archive_title();
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'xt-corporate-lite'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'xt-corporate-lite');
    } else {
        return get_the_title();
    }
}
Example #18
0
/**
 * Page titles
 */
function title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Latest Posts', 'sage');
        }
    } elseif (is_archive()) {
        return get_the_archive_title();
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'sage'), get_search_query());
    } elseif (is_404()) {
        return __('Sorry, we couldn\'t find that page', 'sage');
    } else {
        return get_the_title();
    }
}
Example #19
0
/**
 * Page titles
 */
function title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Latest Posts', 'sage');
        }
    } elseif (is_archive()) {
        return get_the_archive_title();
    } elseif (is_search()) {
        return sprintf(__('%s', 'sage'), get_search_query());
    } elseif (is_404()) {
        return 'SEARCH';
    } else {
        return get_the_title();
    }
}
Example #20
0
/**
 * フォーマットしたアーカイブページのタイトル
 *
 * @param optional bool $is_print true=>print, false=>return
 * @return string or true 
 */
function archive_title($is_print = false)
{
    //アーカイブページとホーム以外はfalseを返す
    if (!\is_archive() && !\is_home()) {
        return false;
    }
    $title = "";
    if (\is_archive()) {
        $raw_title = explode(': ', \esc_html(\get_the_archive_title(), 1));
        if (count($raw_title) == 2) {
            $page_title = $raw_title[1];
        } else {
            $page_title = $raw_title[0];
        }
        $page_title = '<span class="term-name">' . $page_title . '</span>';
    }
    if (\is_home()) {
        $title = '<span class="term-name">' . \esc_html(\get_bloginfo('name')) . '</span>';
    } elseif (\is_category()) {
        //カテゴリーページ
        $title = "『{$page_title}』カテゴリーの記事";
    } elseif (\is_tag()) {
        //タグページ
        $title = "『{$page_title}』タグが付けられた記事";
    } elseif (\is_tax()) {
        //タクソノミーページ
        $title = "『{$page_title}』に分類された記事";
    } elseif (\is_author()) {
        //作成者ページ
        $title = "『{$page_title}』が作成した記事";
    } elseif (\is_year() || \is_month() || \is_date()) {
        //年
        $title = "{$page_title}に作成された記事";
    } else {
        //不明なアーカイブ
        $title = $page_title;
    }
    if ($is_print) {
        echo $title;
        return true;
    } else {
        return $title;
    }
}
Example #21
0
/**
 * Page titles
 */
function title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            $title = get_the_title(get_option('page_for_posts', true));
        } else {
            $title = __('Latest Posts', 'anunatheme');
        }
    } elseif (is_archive()) {
        $title = get_the_archive_title();
    } elseif (is_search()) {
        $title = sprintf(__('Search Results for %s', 'anunatheme'), get_search_query());
    } elseif (is_404()) {
        $title = __('Page Not Found', 'anunatheme');
    } else {
        $title = get_the_title();
    }
    return apply_filters('anunatheme/title', $title);
}
Example #22
0
function title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        }
        return 'Latest Posts';
    }
    if (is_archive()) {
        return get_the_archive_title();
    }
    if (is_search()) {
        return sprintf('Search Results for %s', get_search_query());
    }
    if (is_404()) {
        return 'Not Found';
    }
    return get_the_title();
}
Example #23
0
/**
 * Page titles
 */
function title()
{
    global $post;
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Latest Posts', 'sage');
        }
    } elseif (is_archive()) {
        return get_the_archive_title();
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'sage'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'sage');
    } elseif ($post->post_name == 'who-we-are') {
        return __('for Community-based Children & Family Mental Health', 'sage');
    } else {
        return get_the_title();
    }
}
Example #24
0
/**
 * Page titles
 */
function title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Start Small. Think Big', 'sage');
        }
    } elseif (is_category()) {
        return single_cat_title('', false);
    } elseif (is_author()) {
        return get_the_author();
    } elseif (is_archive()) {
        return get_the_archive_title();
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'sage'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'sage');
    } else {
        return get_the_title();
    }
}
Example #25
0
 /**
  * fb_opengraph
  *
  */
 public static function fb_opengraph()
 {
     $post = new \TimberPost();
     $img = has_post_thumbnail($post->ID) ? wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large')[0] : (get_theme_mod('og_img') ? get_theme_mod('og_img') : esc_url(get_theme_mod('logo')));
     $type = is_author() ? 'profile' : (is_single() ? 'article' : 'website');
     $description = Site::meta_description();
     if (is_tax()) {
         $url = get_term_link(get_query_var('term'), get_query_var('taxonomy'));
         $title = single_term_title('', false);
     } elseif (is_post_type_archive()) {
         $url = get_post_type_archive_link(get_query_var('post_type'));
         $title = get_the_archive_title();
     } else {
         $url = get_permalink();
         $title = get_the_title();
     }
     $url = rtrim(esc_url(apply_filters('og_url', $url)));
     if (!substr($url, -1) === '/') {
         $url .= '/';
         // slash fixes Facebook Debugger "Circular Redirect Path"
     }
     $open_graph = array('site_name' => esc_attr(apply_filters('og_site_name', get_bloginfo())), 'title' => esc_attr(apply_filters('og_title', $title)), 'description' => esc_attr(wp_strip_all_tags(apply_filters('og_description', $description))), 'type' => esc_attr(apply_filters('og_type', $type)), 'url' => $url, 'image' => esc_url(apply_filters('og_image', $img)));
     \Timber::render('open-graph.twig', array('open_graph' => $open_graph));
 }
Example #26
0
<div class="section siteContent">
<div class="container">
<div class="row">

<main class="col-md-8 mainSection" id="main" role="main">

 <?php 
/*-------------------------------------------*/
/*  Archive title
/*-------------------------------------------*/
$page_for_posts = lightning_get_page_for_posts();
// Use post top page( Archive title wrap to div )
if ($page_for_posts['post_top_use'] || get_post_type() != 'post') {
    if (is_year() || is_month() || is_day() || is_tag() || is_author() || is_tax() || is_category()) {
        $archiveTitle = get_the_archive_title();
        echo '<header class="archive-header"><h1>' . $archiveTitle . '</h1></header>';
    }
}
?>

<?php 
/*-------------------------------------------*/
/*  Archive description
/*-------------------------------------------*/
if (is_category() || is_tax() || is_tag()) {
    $category_description = term_description();
    $page = get_query_var('paged', 0);
    if (!empty($category_description) && $page == 0) {
        echo '<div class="archive-meta">' . $category_description . '</div>';
    }
Example #27
0
 function raindrops_emoji_collection($condition = '')
 {
     global $raindrops_tag_emoji, $raindrops_category_emoji;
     $raindrops_tag_emoji_for_archive = '\\' . str_replace(array('&#x', ';'), '', $raindrops_tag_emoji);
     $raindrops_category_emoji_for_archive = '\\' . str_replace(array('&#x', ';'), '', $raindrops_category_emoji);
     $emoji_code = '';
     $condition = get_the_archive_title();
     if (is_tag()) {
         $condition = 'tag';
         $emoji_code = $raindrops_tag_emoji_for_archive;
     }
     if (is_category()) {
         $condition = 'category';
         $emoji_code = $raindrops_category_emoji_for_archive;
     }
     return apply_filters('raindrops_emoji_collection', $emoji_code, $condition);
 }
function corpo_header_title()
{
    //show title in page title bar along with breadcrumbs
    if (is_single() || is_home() && !is_front_page() || is_page() && !is_front_page()) {
        $title = single_post_title('', false);
    } else {
        if (is_archive()) {
            $title = get_the_archive_title();
            //wp v4.1+
        } elseif (is_404()) {
            $title = __('Page not found');
        } elseif (is_search()) {
            $title = 'Search results';
        } else {
            $title = '';
        }
    }
    if ($title == '') {
        //show post id if title is not set
        if (is_single() || is_page()) {
            $title = get_the_ID();
        }
    }
    return $title;
}
Example #29
0
/**
 * The main article-list template
 *
 * @package NordStarter
 */
get_header();
?>

<?php 
do_action('nord_before_page');
?>

<section>
	<h1><?php 
echo get_the_archive_title();
?>
</h1>
	<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        get_template_part('partials/content', 'excerpt');
    }
} else {
    get_template_part('partials/no-results');
}
?>
</section>

<section class="pagination">
Example #30
-1
/**
 * Return a page title based on the current page.
 *
 * @return string
 */
function rock_get_the_page_title()
{
    $title = '';
    switch (true) {
        case is_front_page():
            $title = get_the_title(get_option('page_on_front'));
            break;
        case is_home():
            $title = get_the_title(get_option('page_for_posts'));
            break;
        case is_archive():
            $title = get_the_archive_title();
            break;
        case is_search():
            $title = sprintf(esc_html_x('Search Results for: %s', 'search term', 'rock'), sprintf('<span>%s</span>', get_search_query()));
            break;
        case is_404():
            $title = esc_html__('404 Page Not Found', 'rock');
            break;
        case is_page():
            $title = get_the_title();
            break;
        case ($post = get_queried_object()) && !is_post_type_hierarchical(get_post_type($post)):
            $show_on_front = get_option('show_on_front');
            $page_for_posts = get_option('page_for_posts');
            if ('post' === $post->post_type && 'posts' !== $show_on_front && !empty($page_for_posts)) {
                $title = get_the_title($page_for_posts);
                break;
            }
            $labels = get_post_type_labels(get_post_type_object($post->post_type));
            $title = isset($labels->name) ? $labels->name : false;
            break;
    }
    /**
     * Filter the page title.
     *
     * @since 1.0.0
     *
     * @var string
     */
    return (string) apply_filters('rock_the_page_title', $title);
}