本文整理汇总了PHP中TimberHelper::get_wp_title方法的典型用法代码示例。如果您正苦于以下问题:PHP TimberHelper::get_wp_title方法的具体用法?PHP TimberHelper::get_wp_title怎么用?PHP TimberHelper::get_wp_title使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimberHelper
的用法示例。
在下文中一共展示了TimberHelper::get_wp_title方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWPTitleSingle
function testWPTitleSingle()
{
//since we're testing with twentyfourteen -- need to remove its filters on wp_title
remove_all_filters('wp_title');
$post_id = $this->factory->post->create(array('post_title' => 'My New Post'));
$post = get_post($post_id);
$this->go_to(site_url('?p=' . $post_id));
$this->assertEquals('My New Post', TimberHelper::get_wp_title());
}
示例2: get_context
/**
* Get context.
*
* @return array
*/
public static function get_context()
{
$data = array();
$data['http_host'] = 'http://' . TimberURLHelper::get_host();
$data['wp_title'] = TimberHelper::get_wp_title();
$data['wp_head'] = TimberHelper::function_wrapper('wp_head');
$data['wp_footer'] = TimberHelper::function_wrapper('wp_footer');
$data['body_class'] = implode(' ', get_body_class());
$data['site'] = new TimberSite();
$data['theme'] = $data['site']->theme;
//deprecated, these should be fetched via TimberSite or TimberTheme
$data['theme_dir'] = WP_CONTENT_SUBDIR . str_replace(WP_CONTENT_DIR, '', get_stylesheet_directory());
$data['language_attributes'] = TimberHelper::function_wrapper('language_attributes');
$data['stylesheet_uri'] = get_stylesheet_uri();
$data['template_uri'] = get_template_directory_uri();
$data['posts'] = Timber::query_posts();
//deprecated, this should be fetched via TimberMenu
if (function_exists('wp_nav_menu')) {
$locations = get_nav_menu_locations();
if (count($locations)) {
$data['wp_nav_menu'] = wp_nav_menu(array('container_class' => 'menu-header', 'echo' => false, 'menu_class' => 'nav-menu'));
}
}
$data = apply_filters('timber_context', $data);
$data = apply_filters('timber/context', $data);
return $data;
}
示例3: get_context
/**
* Get context.
*
* @return array
*/
public static function get_context()
{
$data = array();
$data['http_host'] = 'http://' . TimberURLHelper::get_host();
$data['wp_title'] = TimberHelper::get_wp_title();
$data['wp_head'] = TimberHelper::function_wrapper('wp_head');
$data['wp_footer'] = TimberHelper::function_wrapper('wp_footer');
$data['body_class'] = implode(' ', get_body_class());
$data['site'] = new TimberSite();
$data['theme'] = $data['site']->theme;
$data['posts'] = Timber::query_posts();
$data = apply_filters('timber_context', $data);
$data = apply_filters('timber/context', $data);
return $data;
}
示例4: add_to_context
public function add_to_context($context)
{
// Theme Options/Settings - prevent to run twice if child-themed
if (!isset($context['theme_options'])) {
$context['theme_options'] = new TimberFoundation_ThemeOptions();
}
$context = parent::add_to_context($context);
// Override the title and force the seperator on the right
$context['wp_title'] = TimberHelper::get_wp_title('»', 'right');
// Menu
$context = $this->add_menus_to_context($context);
// WP API
$context['dynamic_sidebar'] = TimberHelper::function_wrapper('dynamic_sidebar', array(), true);
$context['is_user_logged_in'] = is_user_logged_in();
$context['current_user'] = is_user_logged_in() ? new TimberUser() : false;
$context['wp_login_url'] = TimberHelper::function_wrapper('wp_login_url', array(get_permalink()));
$context['wp_logout_url'] = TimberHelper::function_wrapper('wp_logout_url', array(get_permalink()));
global $comment_author, $comment_author_email, $comment_author_url;
$context['comment_author'] = $comment_author;
$context['comment_author_email'] = $comment_author_email;
$context['comment_author_url'] = $comment_author_url;
return $context;
}