本文整理汇总了PHP中wp_get_document_title函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_get_document_title函数的具体用法?PHP wp_get_document_title怎么用?PHP wp_get_document_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_get_document_title函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: amp_head_title
function amp_head_title($amp_post)
{
?>
<title><?php
echo wp_get_document_title();
?>
</title>
<?php
}
开发者ID:joedooley,项目名称:amp-wp,代码行数:9,代码来源:amp-template-actions.php
示例2: __construct
public function __construct($post_id)
{
$this->template_dir = AMP__DIR__ . '/templates';
$this->ID = $post_id;
$this->post = get_post($post_id);
$content_max_width = isset($GLOBALS['content_width']) ? absint($GLOBALS['content_width']) : 600;
$content_max_width = apply_filters('amp_content_max_width', $content_max_width);
$this->data = array('content_max_width' => $content_max_width, 'document_title' => function_exists('wp_get_document_title') ? wp_get_document_title() : wp_title('', false), 'canonical_url' => get_permalink($post_id), 'home_url' => home_url(), 'blog_name' => get_bloginfo('name'), 'site_icon_url' => get_site_icon_url(self::SITE_ICON_SIZE), 'placeholder_image_url' => amp_get_asset_url('images/placeholder-icon.png'), 'amp_runtime_script' => 'https://cdn.ampproject.org/v0.js', 'amp_component_scripts' => array());
$this->build_post_content();
$this->build_post_data();
$this->data = apply_filters('amp_post_template_data', $this->data, $this->post);
}
开发者ID:escobar022,项目名称:amp-wp,代码行数:12,代码来源:class-amp-post-template.php
示例3: __construct
public function __construct($post_id)
{
$this->template_dir = apply_filters('amp_post_template_dir', AMP__DIR__ . '/templates');
$this->ID = $post_id;
$this->post = get_post($post_id);
$content_max_width = self::CONTENT_MAX_WIDTH;
if (isset($GLOBALS['content_width']) && $GLOBALS['content_width'] > 0) {
$content_max_width = $GLOBALS['content_width'];
}
$content_max_width = apply_filters('amp_content_max_width', $content_max_width);
$this->data = array('content_max_width' => $content_max_width, 'document_title' => function_exists('wp_get_document_title') ? wp_get_document_title() : wp_title('', false), 'canonical_url' => get_permalink($post_id), 'home_url' => home_url(), 'blog_name' => get_bloginfo('name'), 'body_class' => '', 'site_icon_url' => apply_filters('amp_site_icon_url', function_exists('get_site_icon_url') ? get_site_icon_url(self::SITE_ICON_SIZE) : ''), 'placeholder_image_url' => amp_get_asset_url('images/placeholder-icon.png'), 'featured_image' => false, 'comments_link_url' => false, 'comments_link_text' => false, 'amp_runtime_script' => 'https://cdn.ampproject.org/v0.js', 'amp_component_scripts' => array(), 'customizer_settings' => array(), 'font_urls' => array('merriweather' => 'https://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic'), 'amp_analytics' => apply_filters('amp_post_template_analytics', array(), $this->post));
$this->build_post_content();
$this->build_post_data();
$this->build_customizer_settings();
$this->data = apply_filters('amp_post_template_data', $this->data, $this->post);
}
开发者ID:thenextweb,项目名称:amp-wp,代码行数:16,代码来源:class-amp-post-template.php
示例4: header
* @package WP Idea Stream
* @subpackage Templates
* @since 2.3.0
*/
if (!headers_sent()) {
header('X-WP-embed: true');
}
?>
<!DOCTYPE html>
<html <?php
language_attributes();
?>
class="no-js">
<head>
<title><?php
echo wp_get_document_title();
?>
</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<?php
/**
* Print scripts or data in the embed template <head> tag.
*
* @since 2.3.0
*/
do_action('embed_head');
?>
</head>
<body <?php
body_class();
?>
开发者ID:mrjarbenne,项目名称:wp-idea-stream,代码行数:31,代码来源:embed-profile.php
示例5: _wp_render_title_tag
/**
* Displays title tag with content.
*
* @ignore
* @since 4.1.0
* @since 4.4.0 Improved title output replaced `wp_title()`.
* @access private
*/
function _wp_render_title_tag()
{
if (!current_theme_supports('title-tag')) {
return;
}
echo '<title>' . wp_get_document_title() . '</title>' . "\n";
}
开发者ID:blogfor,项目名称:king,代码行数:15,代码来源:general-template.php
示例6: get_wp_title_rss
/**
* Retrieve the blog title for the feed title.
*
* @since 2.2.0
* @since 4.4.0 The optional `$sep` parameter was deprecated and renamed to `$deprecated`.
*
* @param string $deprecated Unused..
* @return string The document title.
*/
function get_wp_title_rss($deprecated = '–')
{
if ('–' !== $deprecated) {
/* translators: %s: 'document_title_separator' filter name */
_deprecated_argument(__FUNCTION__, '4.4.0', sprintf(__('Use the %s filter instead.'), '<code>document_title_separator</code>'));
}
/**
* Filter the blog title for use as the feed title.
*
* @since 2.2.0
* @since 4.4.0 The `$sep` parameter was deprecated and renamed to `$deprecated`.
*
* @param string $title The current blog title.
* @param string $deprecated Unused.
*/
return apply_filters('get_wp_title_rss', wp_get_document_title(), $deprecated);
}
开发者ID:austinsatmosphere,项目名称:ifxweather,代码行数:26,代码来源:feed.php
示例7: tribe_events_the_header_attributes
/**
* Prints out data attributes used in the template header tags
*
* @category Events
* @param string|null $current_view
*
* @todo move to template classes
**/
function tribe_events_the_header_attributes($current_view = null)
{
$attrs = array();
$current_view = !empty($current_view) ? $current_view : basename(tribe_get_current_template());
// wp_title was deprecated in WordPress 4.4. Fetch the document title with the new function (added in 4.4) if available
if (function_exists('wp_get_document_title')) {
$attrs['data-title'] = wp_get_document_title();
} else {
$attrs['data-title'] = wp_title('|', false, 'right');
}
switch ($current_view) {
case 'month.php':
$attrs['data-view'] = 'month';
$attrs['data-date'] = date('Y-m', strtotime(tribe_get_month_view_date()));
$attrs['data-baseurl'] = tribe_get_gridview_link(false);
break;
case 'day.php':
$attrs['data-startofweek'] = get_option('start_of_week');
break;
case 'list.php':
$attrs['data-startofweek'] = get_option('start_of_week');
$attrs['data-view'] = 'list';
if (tribe_is_upcoming()) {
$attrs['data-baseurl'] = tribe_get_listview_link(false);
} elseif (tribe_is_past()) {
$attrs['data-view'] = 'past';
$attrs['data-baseurl'] = tribe_get_listview_past_link(false);
}
break;
}
if (has_filter('tribe_events_mobile_breakpoint')) {
$attrs['data-mobilebreak'] = tribe_get_mobile_breakpoint();
}
$attrs = apply_filters('tribe_events_header_attributes', $attrs, $current_view);
foreach ($attrs as $attr => $value) {
echo " {$attr}=" . '"' . esc_attr($value) . '"';
}
}
开发者ID:reubenbrown13,项目名称:the-events-calendar,代码行数:46,代码来源:general.php
示例8: elegant_titles
function elegant_titles()
{
if (!function_exists('wp_get_document_title')) {
wp_title();
} else {
echo wp_get_document_title();
}
}
开发者ID:bigger-sea,项目名称:B-projektai,代码行数:8,代码来源:custom_functions.php
示例9: wp_title_fallback
/**
* Provide a fallback for versions of WP (<4.4) before wp_title was deprecated.
* @param string $sep Legacy wp_title separator
* @param string $seplocation Legacy wp_title direction to display title
* @return string Title, either from wp_title or from wp_get_document_title
*/
function wp_title_fallback($sep = '»', $seplocation = '')
{
if (function_exists('wp_get_document_title')) {
$this->now_requesting_wp_title = true;
$title = wp_get_document_title();
$this->now_requesting_wp_title = false;
return $title;
}
/* we'll always return, never display; therefore, $display always passed as false */
return wp_title($sep, false, $seplocation);
}
开发者ID:EasterAndJay,项目名称:tamichelew.com,代码行数:17,代码来源:ghpseo.php
示例10: test_change_title_separator
function test_change_title_separator()
{
$this->go_to('?p=' . $this->post_id);
add_filter('document_title_separator', array($this, '_change_title_separator'));
$this->assertEquals(sprintf('test_title %%%% %s', $this->blog_name), wp_get_document_title());
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:6,代码来源:document-title.php
示例11: custom_title
/**
* Custom title.
*
* @since 1.0.0
*/
public static function custom_title()
{
?>
<?php
if (function_exists('wp_get_document_title')) {
?>
<title><?php
echo wp_get_document_title();
?>
</title>
<?php
} else {
?>
<title><?php
bloginfo('name');
?>
- <?php
the_title();
?>
</title>
<?php
}
?>
<?php
}
开发者ID:wensolutions,项目名称:demo-bar,代码行数:30,代码来源:class-demobar-switcher.php
示例12: _shortcode_shareblock
/**
* Short code the share block.
*
* @return string
*/
protected function _shortcode_shareblock()
{
$output = null;
$tmp = self::_tmp_shareblock();
$tmp_wrapper = self::_tmp_wrapper_shareblock();
$sns = Variable::sns_list();
$current_url = home_url(add_query_arg(array()));
$current_title = wp_get_document_title();
if (!empty($current_url) && !empty($current_title)) {
foreach ($sns as $key => $value) {
$output[$key] = $tmp;
$output[$key] = str_replace('{{prefix}}', sanitize_html_class($key), $output[$key]);
$output[$key] = str_replace('{{endpoint}}', $value['endpoint'], $output[$key]);
$output[$key] = str_replace('{{anchor_text}}', $value['anchor_text'], $output[$key]);
$output[$key] = str_replace('{{permalink}}', rawurlencode(esc_url($current_url)), $output[$key]);
$output[$key] = str_replace('{{post_title}}', urlencode($current_title), $output[$key]);
}
$output = implode('', $output);
}
if (!empty($output)) {
$output = str_replace('{{content}}', $output, $tmp_wrapper);
}
return $output;
}
开发者ID:visualive,项目名称:va-social-buzz,代码行数:29,代码来源:class-module-shortcode.php
示例13: pc_adjust
/**
* 手动加入页面作为手机版的 PC 适配显示
*/
function pc_adjust()
{
if (wp_is_mobile() || @$_GET['_embed'] == '1') {
return;
}
ob_clean();
$url = $_SERVER['REQUEST_URI'];
if (strpos($url, '?') !== false) {
$url .= '&';
} else {
$url .= '?';
}
?>
<!DOCTYPE html><html><head><title><?php
echo wp_get_document_title();
?>
</title></head>
<body style="background: #555">
<iframe width="480" height="848" style="margin: 0 auto; border:0" src="<?php
echo $url;
?>
_embed=1"></iframe>
<script>
if(top !== window && !/_embed=1/.test(location.query)) {
top.location.href = location.href;
}
</script>
</body>
</html><?php
exit;
}
开发者ID:EaseCloud,项目名称:wordpress,代码行数:34,代码来源:functions.php
示例14: language_attributes
<html id="ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html id="ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo('charset'); ?>" />
<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,width=device-width" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<?php
echo $theme->render('meta');
// OpenGraph meta tags
$pageTitle = wp_get_document_title();
$pageUrl = get_permalink();
$pageType = 'website';
$pageImage = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) );
if (is_front_page()) {
$postExcerpt = "We are a church of communities following Jesus as we worship, pray, and love others in Orange County, Charlotte, and beyond. Come join us!";
} else if (isset($post->post_excerpt) && $post->post_excerpt != '') {
$postExcerpt = $post->post_excerpt;
} else {
$postExcerpt = wp_strip_all_tags($post->post_content, true);
}
?>
<!-- OpenGraph meta tags -->
<meta property="og:title" content="<?php echo $pageTitle; ?>" />
<meta property="og:type" content="<?php echo $pageType; ?>" />
<meta property="og:url" content="<?php echo $pageUrl; ?>" />
开发者ID:rockharbor,项目名称:rockharbor,代码行数:31,代码来源:header-prebody.php
注:本文中的wp_get_document_title函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论