本文整理汇总了PHP中WPSEO_Meta类的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Meta类的具体用法?PHP WPSEO_Meta怎么用?PHP WPSEO_Meta使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WPSEO_Meta类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: upgrade_15
/**
* Run the Yoast SEO 1.5 upgrade routine
*
* @param string $version Current plugin version.
*/
private function upgrade_15($version)
{
// Clean up options and meta.
WPSEO_Options::clean_up(null, $version);
WPSEO_Meta::clean_up();
// Add new capabilities on upgrade.
wpseo_add_capabilities();
}
开发者ID:Didox,项目名称:beminfinito,代码行数:13,代码来源:class-upgrade.php
示例2: has_video
/**
* Helper function to check if the metabox functionality should be loaded
*
* @return bool
*/
public function has_video()
{
if (isset($GLOBALS['post']->ID)) {
$video = WPSEO_Meta::get_value('video_meta', $GLOBALS['post']->ID);
if (is_array($video) && $video !== array()) {
return true;
}
}
return false;
}
开发者ID:scottnkerr,项目名称:eeco,代码行数:15,代码来源:class-wpseo-video-metabox.php
示例3: import_post_robot
/**
* Getting the wpSEO robot value and map this to Yoast SEO values.
*
* @param integer $post_id The post id of the current post.
*/
private function import_post_robot($post_id)
{
$wpseo_robots = get_post_meta($post_id, '_wpseo_edit_robots', true);
// Does the value exists in our mapping.
if ($robot_value = $this->get_robot_value($wpseo_robots)) {
// Saving the new meta values for Yoast SEO.
WPSEO_Meta::set_value($robot_value['index'], 'meta-robots-noindex', $post_id);
WPSEO_Meta::set_value($robot_value['follow'], 'meta-robots-nofollow', $post_id);
}
$this->delete_post_robot($post_id);
}
开发者ID:Didox,项目名称:beminfinito,代码行数:16,代码来源:class-import-wpseo.php
示例4: description
/**
* Output the Google+ specific description
*/
public function description()
{
if (is_singular()) {
$desc = WPSEO_Meta::get_value('google-plus-description');
/**
* Filter: 'wpseo_googleplus_desc' - Allow developers to change the Google+ specific description output
*
* @api string $desc The description string
*/
$desc = apply_filters('wpseo_googleplus_desc', $desc);
if (is_string($desc) && '' !== $desc) {
echo '<meta itemprop="description" content="' . $desc . '">' . "\n";
}
}
}
开发者ID:kyme-online,项目名称:Ramesh-Photography,代码行数:18,代码来源:class-googleplus.php
示例5: italystrap_open_graph_desc
/**
* Display post description for Open Graph and Twitter card
*
* @return string A description text of post
*
* @todo Sanitize $excerpt http://codex.wordpress.org/Function_Reference/sanitize_text_field
*/
function italystrap_open_graph_desc()
{
global $post;
if (function_exists('aioseop_load_modules')) {
$excerpt = get_post_meta($post->ID, '_aioseop_description', true);
} else {
if (class_exists('WPSEO_Meta')) {
$excerpt = WPSEO_Meta::get_value('metadesc');
} else {
if ($post->post_excerpt) {
$excerpt = trim(str_replace(array("\n", "\r", "\t"), ' ', substr(strip_tags($post->post_excerpt), 0, 200)));
} else {
$excerpt = trim(str_replace(array("\n", "\r", "\t", "[", "]", "\""), ' ', substr(strip_tags($post->post_content), 0, 200))) . ' ...';
}
}
}
echo $excerpt;
}
开发者ID:AndrGelmini,项目名称:ItalyStrap,代码行数:25,代码来源:schema.php
示例6: test_description
/**
* @covers WPSEO_GooglePlus::description
*/
public function test_description()
{
self::$class_instance->description();
$this->expectOutput('');
// create and go to post
$post_id = $this->factory->post->create();
$this->go_to(get_permalink($post_id));
// should be empty, didn't set google-plus-description
self::$class_instance->description();
$this->expectOutput('');
// set meta
$description = 'Google description';
WPSEO_Meta::set_value('google-plus-description', $description, $post_id);
// test output
$expected = '<meta itemprop="description" content="' . $description . '">' . "\n";
self::$class_instance->description();
$this->expectOutput($expected);
}
开发者ID:centre-for-effective-altruism,项目名称:wordpress-seo,代码行数:21,代码来源:test-class-googleplus.php
示例7: status_transition
/**
* Hooked into transition_post_status. Will initiate search engine pings
* if the post is being published, is a post type that a sitemap is built for
* and is a post that is included in sitemaps.
*/
function status_transition($new_status, $old_status, $post)
{
if ($new_status != 'publish') {
return;
}
wp_cache_delete('lastpostmodified:gmt:' . $post->post_type, 'timeinfo');
// #17455
$options = WPSEO_Options::get_all();
if (isset($options['post_types-' . $post->post_type . '-not_in_sitemap']) && $options['post_types-' . $post->post_type . '-not_in_sitemap'] === true) {
return;
}
if (WP_CACHE) {
wp_schedule_single_event(time() + 300, 'wpseo_hit_sitemap_index');
}
// Allow the pinging to happen slightly after the hit sitemap index so the sitemap is fully regenerated when the ping happens.
if (WPSEO_Meta::get_value('sitemap-include', $post->ID) !== 'never') {
if (defined('YOAST_SEO_PING_IMMEDIATELY') && YOAST_SEO_PING_IMMEDIATELY) {
wpseo_ping_search_engines();
} else {
wp_schedule_single_event(time() + 300, 'wpseo_ping_search_engines');
}
}
}
开发者ID:kyme-online,项目名称:Ramesh-Photography,代码行数:28,代码来源:class-sitemaps-admin.php
示例8: get_opengraph_image
/**
* If opengraph-image is set, call add_image and return true
*
* @return bool
*/
private function get_opengraph_image()
{
$ogimg = WPSEO_Meta::get_value('opengraph-image');
if ($ogimg !== '') {
$this->add_image($ogimg);
return true;
}
}
开发者ID:goodbayscott,项目名称:wwr-temp,代码行数:13,代码来源:class-opengraph.php
示例9: foreach
$posts = $wpdb->get_results("SELECT ID, robotsmeta FROM {$wpdb->posts}");
if (is_array($posts) && $posts !== array()) {
foreach ($posts as $post) {
// sync all possible settings
if ($post->robotsmeta) {
$pieces = explode(',', $post->robotsmeta);
foreach ($pieces as $meta) {
switch ($meta) {
case 'noindex':
WPSEO_Meta::set_value('meta-robots-noindex', '1', $post->ID);
break;
case 'index':
WPSEO_Meta::set_value('meta-robots-noindex', '2', $post->ID);
break;
case 'nofollow':
WPSEO_Meta::set_value('meta-robots-nofollow', '1', $post->ID);
break;
}
}
}
}
}
unset($posts, $post, $pieces, $meta);
$msg .= __(sprintf('Robots Meta values imported. We recommend %sdisabling the Robots-Meta plugin%s to avoid any conflicts.', '<a href="' . esc_url(admin_url('admin.php?page=wpseo_import&deactivate_robots_meta=1')) . '">', '</a>'), 'wordpress-seo');
}
if (isset($_POST['wpseo']['importrssfooter'])) {
$optold = get_option('RSSFooterOptions');
$optnew = get_option('wpseo_rss');
if ($optold['position'] == 'after') {
if ($optnew['rssafter'] === '' || $optnew['rssafter'] === WPSEO_Options::get_default('wpseo_rss', 'rssafter')) {
$optnew['rssafter'] = $optold['footerstring'];
开发者ID:rinodung,项目名称:myfreetheme,代码行数:31,代码来源:import.php
示例10: get_link_info_for_id
/**
* Retrieve link url and text based on post id
*
* @param int $id Post id
*
* @return array $link Array of link text and url
*/
private function get_link_info_for_id($id)
{
$link = array();
$link['url'] = get_permalink($id);
$link['text'] = WPSEO_Meta::get_value('bctitle', $id);
if ($link['text'] === '') {
$link['text'] = strip_tags(get_the_title($id));
}
/**
* Filter: 'wp_seo_get_bc_title' - Allow developer to filter the WP SEO Breadcrumb title.
*
* @api string $link_text The Breadcrumb title text
*
* @param int $link_id The post ID
*/
$link['text'] = apply_filters('wp_seo_get_bc_title', $link['text'], $id);
return $link;
}
开发者ID:johnreytepacia,项目名称:etarticles,代码行数:25,代码来源:class-breadcrumbs.php
示例11: wpseo_admin_bar_menu
/**
* Adds an SEO admin bar menu with several options. If the current user is an admin he can also go straight to several settings menu's from here.
*/
function wpseo_admin_bar_menu()
{
// If the current user can't write posts, this is all of no use, so let's not output an admin menu.
if (!current_user_can('edit_posts')) {
return;
}
global $wp_admin_bar, $post;
$focuskw = '';
$score = '';
$seo_url = get_admin_url(null, 'admin.php?page=wpseo_dashboard');
if ((is_singular() || is_admin() && in_array($GLOBALS['pagenow'], array('post.php', 'post-new.php'), true)) && isset($post) && is_object($post) && apply_filters('wpseo_use_page_analysis', true) === true) {
$focuskw = WPSEO_Meta::get_value('focuskw', $post->ID);
$perc_score = WPSEO_Meta::get_value('linkdex', $post->ID);
$txtscore = WPSEO_Utils::translate_score($perc_score);
$title = WPSEO_Utils::translate_score($perc_score, false);
$score = '<div title="' . esc_attr($title) . '" class="' . esc_attr('wpseo-score-icon ' . $txtscore . ' ' . $perc_score) . ' adminbar-seo-score' . '"></div>';
$seo_url = get_edit_post_link($post->ID);
}
$wp_admin_bar->add_menu(array('id' => 'wpseo-menu', 'title' => __('SEO', 'wordpress-seo') . $score, 'href' => $seo_url));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-kwresearch', 'title' => __('Keyword Research', 'wordpress-seo'), '#'));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-adwordsexternal', 'title' => __('AdWords External', 'wordpress-seo'), 'href' => 'http://adwords.google.com/keywordplanner', 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-googleinsights', 'title' => __('Google Insights', 'wordpress-seo'), 'href' => 'http://www.google.com/insights/search/#q=' . urlencode($focuskw) . '&cmpt=q', 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-wordtracker', 'title' => __('SEO Book', 'wordpress-seo'), 'href' => 'http://tools.seobook.com/keyword-tools/seobook/?keyword=' . urlencode($focuskw), 'meta' => array('target' => '_blank')));
if (!is_admin()) {
$url = WPSEO_Frontend::get_instance()->canonical(false);
if (is_string($url)) {
$wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-analysis', 'title' => __('Analyze this page', 'wordpress-seo'), '#'));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-inlinks-ose', 'title' => __('Check Inlinks (OSE)', 'wordpress-seo'), 'href' => '//moz.com/researchtools/ose/links?site=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-kwdensity', 'title' => __('Check Keyword Density', 'wordpress-seo'), 'href' => '//www.zippy.co.uk/keyworddensity/index.php?url=' . urlencode($url) . '&keyword=' . urlencode($focuskw), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-cache', 'title' => __('Check Google Cache', 'wordpress-seo'), 'href' => '//webcache.googleusercontent.com/search?strip=1&q=cache:' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-header', 'title' => __('Check Headers', 'wordpress-seo'), 'href' => '//quixapp.com/headers/?r=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-richsnippets', 'title' => __('Check Rich Snippets', 'wordpress-seo'), 'href' => '//www.google.com/webmasters/tools/richsnippets?q=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-facebookdebug', 'title' => __('Facebook Debugger', 'wordpress-seo'), 'href' => '//developers.facebook.com/tools/debug/og/object?q=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-pinterestvalidator', 'title' => __('Pinterest Rich Pins Validator', 'wordpress-seo'), 'href' => '//developers.pinterest.com/rich_pins/validator/?link=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-htmlvalidation', 'title' => __('HTML Validator', 'wordpress-seo'), 'href' => '//validator.w3.org/check?uri=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-cssvalidation', 'title' => __('CSS Validator', 'wordpress-seo'), 'href' => '//jigsaw.w3.org/css-validator/validator?uri=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-pagespeed', 'title' => __('Google Page Speed Test', 'wordpress-seo'), 'href' => '//developers.google.com/speed/pagespeed/insights/?url=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-modernie', 'title' => __('Modern IE Site Scan', 'wordpress-seo'), 'href' => '//www.modern.ie/en-us/report#' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-google-mobile-friendly', 'title' => __('Mobile-Friendly Test', 'wordpress-seo'), 'href' => 'https://www.google.com/webmasters/tools/mobile-friendly/?url=' . urlencode($url), 'meta' => array('target' => '_blank')));
}
}
$admin_menu = current_user_can('manage_options');
if (!$admin_menu && is_multisite()) {
$options = get_site_option('wpseo_ms');
$admin_menu = $options['access'] === 'superadmin' && is_super_admin();
}
// @todo: add links to bulk title and bulk description edit pages.
if ($admin_menu) {
$wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-settings', 'title' => __('SEO Settings', 'wordpress-seo')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-general', 'title' => __('General', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_dashboard')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-titles', 'title' => __('Titles & Metas', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_titles')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-social', 'title' => __('Social', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_social')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-xml', 'title' => __('XML Sitemaps', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_xml')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-wpseo-advanced', 'title' => __('Advanced', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_advanced')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-tools', 'title' => __('Tools', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_tools')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-search-console', 'title' => __('Search Console', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_search_console')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-licenses', 'title' => '<span style="color:#f18500">' . __('Extensions', 'wordpress-seo') . '</span>', 'href' => admin_url('admin.php?page=wpseo_licenses')));
}
}
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:62,代码来源:wpseo-non-ajax-functions.php
示例12: wpseo_admin_bar_menu
/**
* Adds an SEO admin bar menu with several options. If the current user is an admin he can also go straight to several settings menu's from here.
*/
function wpseo_admin_bar_menu()
{
// If the current user can't write posts, this is all of no use, so let's not output an admin menu
if (!current_user_can('edit_posts')) {
return;
}
global $wp_admin_bar, $post;
$url = WPSEO_Frontend::get_instance()->canonical(false);
$focuskw = '';
$score = '';
$seo_url = get_admin_url(null, 'admin.php?page=wpseo_dashboard');
if ((is_singular() || is_admin() && in_array($GLOBALS['pagenow'], array('post.php', 'post-new.php'), true)) && isset($post) && is_object($post) && apply_filters('wpseo_use_page_analysis', true) === true) {
$focuskw = WPSEO_Meta::get_value('focuskw', $post->ID);
$perc_score = WPSEO_Meta::get_value('linkdex', $post->ID);
$calc_score = WPSEO_Utils::calc($perc_score, '/', 10, true);
$txtscore = WPSEO_Utils::translate_score($calc_score);
$title = WPSEO_Utils::translate_score($calc_score, false);
$score = '<div title="' . esc_attr($title) . '" class="' . esc_attr('wpseo-score-icon ' . $txtscore . ' ' . $perc_score) . '"></div>';
$seo_url = get_edit_post_link($post->ID);
if ($txtscore !== 'na') {
$seo_url .= '#wpseo_linkdex';
}
}
$wp_admin_bar->add_menu(array('id' => 'wpseo-menu', 'title' => __('SEO', 'wordpress-seo') . $score, 'href' => $seo_url));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-kwresearch', 'title' => __('Keyword Research', 'wordpress-seo'), '#'));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-adwordsexternal', 'title' => __('AdWords External', 'wordpress-seo'), 'href' => 'http://adwords.google.com/keywordplanner', 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-googleinsights', 'title' => __('Google Insights', 'wordpress-seo'), 'href' => 'http://www.google.com/insights/search/#q=' . urlencode($focuskw) . '&cmpt=q', 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-wordtracker', 'title' => __('SEO Book', 'wordpress-seo'), 'href' => 'http://tools.seobook.com/keyword-tools/seobook/?keyword=' . urlencode($focuskw), 'meta' => array('target' => '_blank')));
if (!is_admin()) {
$wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-analysis', 'title' => __('Analyze this page', 'wordpress-seo'), '#'));
if (is_string($url)) {
// @todo [JRF => whomever] check if this url shouldn't be encoded either with urlencode or with esc_url or something
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-inlinks-ose', 'title' => __('Check Inlinks (OSE)', 'wordpress-seo'), 'href' => '//moz.com/researchtools/ose/links?site=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-kwdensity', 'title' => __('Check Keyword Density', 'wordpress-seo'), 'href' => '//www.zippy.co.uk/keyworddensity/index.php?url=' . urlencode($url) . '&keyword=' . urlencode($focuskw), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-cache', 'title' => __('Check Google Cache', 'wordpress-seo'), 'href' => '//webcache.googleusercontent.com/search?strip=1&q=cache:' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-header', 'title' => __('Check Headers', 'wordpress-seo'), 'href' => '//quixapp.com/headers/?r=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-richsnippets', 'title' => __('Check Rich Snippets', 'wordpress-seo'), 'href' => '//www.google.com/webmasters/tools/richsnippets?q=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-facebookdebug', 'title' => __('Facebook Debugger', 'wordpress-seo'), 'href' => '//developers.facebook.com/tools/debug/og/object?q=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-pinterestvalidator', 'title' => __('Pinterest Rich Pins Validator', 'wordpress-seo'), 'href' => '//developers.pinterest.com/rich_pins/validator/?link=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-htmlvalidation', 'title' => __('HTML Validator', 'wordpress-seo'), 'href' => '//validator.w3.org/check?uri=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-cssvalidation', 'title' => __('CSS Validator', 'wordpress-seo'), 'href' => '//jigsaw.w3.org/css-validator/validator?uri=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-pagespeed', 'title' => __('Google Page Speed Test', 'wordpress-seo'), 'href' => '//developers.google.com/speed/pagespeed/insights/?url=' . urlencode($url), 'meta' => array('target' => '_blank')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-modernie', 'title' => __('Modern IE Site Scan', 'wordpress-seo'), 'href' => '//www.modern.ie/en-us/report#' . urlencode($url), 'meta' => array('target' => '_blank')));
}
}
$admin_menu = false;
if (is_multisite()) {
$options = get_site_option('wpseo_ms');
if ($options['access'] === 'superadmin' && is_super_admin()) {
$admin_menu = true;
} elseif (current_user_can('manage_options')) {
$admin_menu = true;
}
} elseif (current_user_can('manage_options')) {
$admin_menu = true;
}
// @todo: add links to bulk title and bulk description edit pages
if ($admin_menu) {
$wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-settings', 'title' => __('SEO Settings', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_titles')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-titles', 'title' => __('Titles & Metas', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_titles')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-social', 'title' => __('Social', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_social')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-xml', 'title' => __('XML Sitemaps', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_xml')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-permalinks', 'title' => __('Permalinks', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_permalinks')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-internal-links', 'title' => __('Internal Links', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_internal-links')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-rss', 'title' => __('RSS', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_rss')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-import', 'title' => esc_html__('Import & Export', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_import')));
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo_bulk-editor', 'title' => __('Bulk Editor', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_bulk-editor')));
// Check where to add the edit files page
if (WPSEO_Utils::allow_system_file_edit() === true) {
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-files', 'title' => __('Edit Files', 'wordpress-seo'), 'href' => network_admin_url('admin.php?page=wpseo_files')));
// will auto-use admin_url if not in multi-site
}
$wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-licenses', 'title' => __('Extensions', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_licenses')));
}
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:78,代码来源:wpseo-non-ajax-functions.php
示例13: import_metas
/**
* Import All In One SEO meta values
*/
private function import_metas()
{
WPSEO_Meta::replace_meta('_aioseop_description', WPSEO_Meta::$meta_prefix . 'metadesc', $this->replace);
WPSEO_Meta::replace_meta('_aioseop_keywords', WPSEO_Meta::$meta_prefix . 'metakeywords', $this->replace);
WPSEO_Meta::replace_meta('_aioseop_title', WPSEO_Meta::$meta_prefix . 'title', $this->replace);
}
开发者ID:goodbayscott,项目名称:wwr-temp,代码行数:9,代码来源:class-import-aioseo.php
示例14: retrieve_focuskw
/**
* Retrieve the post/page/cpt's focus keyword for use as replacement string.
*
* @return string|null
*/
private function retrieve_focuskw()
{
$replacement = null;
if (!empty($this->args->ID)) {
$focus_kw = WPSEO_Meta::get_value('focuskw', $this->args->ID);
if ($focus_kw !== '') {
$replacement = $focus_kw;
}
}
return $replacement;
}
开发者ID:ramiy,项目名称:wordpress-seo,代码行数:16,代码来源:class-wpseo-replace-vars.php
示例15: test_get_post_value_default
/**
* Test default value returned when non-existant $_POST key supplied
* @covers WPSEO_Meta::get_post_value
*/
public function test_get_post_value_default()
{
$this->assertEquals('', WPSEO_Meta::get_post_value('my_missing_test_key'));
}
开发者ID:valeriosouza,项目名称:wordpress-seo,代码行数:8,代码来源:test-class-wpseo-meta.php
示例16: get_meta_boxes
/**
* Defines the meta box inputs
*
* @since 0.1
* @deprecated 1.6.0
* @deprecated use WPSEO_Meta::get_meta_field_defs()
* @see WPSEO_Meta::get_meta_field_defs()
*
* @param string $post_type The current post type
*
* @return array Meta box inputs
*/
public function get_meta_boxes($post_type = 'post')
{
_deprecated_function(__METHOD__, 'Video SEO 1.6.0', 'WPSEO_Meta::get_meta_field_defs()');
return WPSEO_Meta::get_meta_field_defs('video', $post_type);
}
开发者ID:bitrecruiter,项目名称:wordpress-stackable,代码行数:17,代码来源:video-seo.php
示例17: description
/**
* Output the OpenGraph description, specific OG description first, if not, grab the meta description.
*
* @param bool $echo Whether to echo or return the description
*
* @return string $ogdesc
*/
public function description($echo = true)
{
$ogdesc = '';
if (is_front_page()) {
$ogdesc = $this->options['og_frontpage_desc'] !== '' ? $this->options['og_frontpage_desc'] : $this->metadesc(false);
}
if (is_singular()) {
$ogdesc = WPSEO_Meta::get_value('opengraph-description');
// Replace WP SEO Variables
$ogdesc = wpseo_replace_vars($ogdesc, get_post());
// Use metadesc if $ogdesc is empty
if ($ogdesc === '') {
$ogdesc = $this->metadesc(false);
}
// og:description is still blank so grab it from get_the_excerpt()
if (!is_string($ogdesc) || is_string($ogdesc) && $ogdesc === '') {
$ogdesc = str_replace('[…]', '…', strip_tags(get_the_excerpt()));
}
}
if (is_category() || is_tag() || is_tax()) {
$ogdesc = trim(strip_tags(term_description()));
}
// Strip shortcodes if any
$ogdesc = strip_shortcodes($ogdesc);
/**
* Filter: 'wpseo_opengraph_desc' - Allow changing the OpenGraph description
*
* @api string $ogdesc The description string.
*/
$ogdesc = apply_filters('wpseo_opengraph_desc', $ogdesc);
if (is_string($ogdesc) && $ogdesc !== '') {
if ($echo !== false) {
$this->og_tag('og:description', $ogdesc);
}
}
return $ogdesc;
}
开发者ID:phuluang,项目名称:rosewellmusic,代码行数:44,代码来源:class-opengraph.php
示例18: wpseo_init
/**
* On plugins_loaded: load the minimum amount of essential files for this plugin
*/
function wpseo_init()
{
require_once WPSEO_PATH . 'inc/wpseo-functions.php';
// Make sure our option and meta value validation routines and default values are always registered and available.
WPSEO_Options::get_instance();
WPSEO_Meta::init();
$options = WPSEO_Options::get_options(array('wpseo', 'wpseo_permalinks', 'wpseo_xml'));
if (version_compare($options['version'], WPSEO_VERSION, '<')) {
new WPSEO_Upgrade();
// Get a cleaned up version of the $options.
$options = WPSEO_Options::get_options(array('wpseo', 'wpseo_permalinks', 'wpseo_xml'));
}
if ($options['stripcategorybase'] === true) {
$GLOBALS['wpseo_rewrite'] = new WPSEO_Rewrite();
}
if ($options['enablexmlsitemap'] === true) {
$GLOBALS['wpseo_sitemaps'] = new WPSEO_Sitemaps();
}
if (!defined('DOING_AJAX') || !DOING_AJAX) {
require_once WPSEO_PATH . 'inc/wpseo-non-ajax-functions.php';
}
// Init it here because the filter must be present on the frontend as well or it won't work in the customizer.
new WPSEO_Customizer();
}
开发者ID:misfist,项目名称:missdrepants-network,代码行数:27,代码来源:wp-seo-main.php
示例19: bloginfo
bloginfo('template_directory');
?>
/favicon/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="<?php
bloginfo('template_directory');
?>
/favicon/apple-touch-icon-114x114.png">
<!-- Facebook open graph tags -->
<meta property="og:title" content="<?php
the_title();
?>
"/>
<meta property="og:description" content="<?php
if (function_exists('WPSEO_Meta::get_value()')) {
echo WPSEO_Meta::get_value('metadesc');
} else {
echo $post->post_excerpt;
}
?>
"/>
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
}
}
?>
<meta property="fb:app_id" content="496408310403833" />
<?php
开发者ID:Bebeau,项目名称:sophieuliano,代码行数:31,代码来源:header.php
示例20: replace_meta
/**
* Used for imports, both in dashboard and import settings pages, this functions either copies
* $old_metakey into $new_metakey or just plain replaces $old_metakey with $new_metakey
*
* @deprecated 1.5.0
* @deprecated use WPSEO_Meta::replace_meta()
* @see WPSEO_Meta::replace_meta()
*
* @param string $old_metakey The old name of the meta value.
* @param string $new_metakey The new name of the meta value, usually the WP SEO name.
* @param bool $replace Whether to replace or to copy the values.
*/
function replace_meta($old_metakey, $new_metakey, $replace = false)
{
_deprecated_function(__FUNCTION__, 'WPSEO 1.5.0', 'WPSEO_Meta::replace_meta()');
WPSEO_Meta::replace_meta($old_metakey, $new_metakey, $replace);
}
开发者ID:presteege,项目名称:presteege.fr,代码行数:17,代码来源:wpseo-functions.php
注:本文中的WPSEO_Meta类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论