• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP WPSEO_Frontend类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中WPSEO_Frontend的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Frontend类的具体用法?PHP WPSEO_Frontend怎么用?PHP WPSEO_Frontend使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WPSEO_Frontend类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: webdados_fb_open_graph


//.........这里部分代码省略.........
                                    $fb_url = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day'));
                                } else {
                                    if (is_month()) {
                                        $fb_title = esc_attr(strip_tags(stripslashes(single_month_title(' ', false) . ' ' . __('Archives'))));
                                        $fb_url = get_month_link(get_query_var('year'), get_query_var('monthnum'));
                                    } else {
                                        if (is_year()) {
                                            $fb_title = esc_attr(strip_tags(stripslashes(get_query_var('year') . ' ' . __('Archives'))));
                                            $fb_url = get_year_link(get_query_var('year'));
                                        }
                                    }
                                }
                            } else {
                                if (is_front_page()) {
                                    $fb_url = get_option('home') . (intval($fb_url_add_trailing) == 1 ? '/' : '');
                                    $fb_type = trim($fb_type_homepage == '' ? 'website' : $fb_type_homepage);
                                } else {
                                    //Others... Defaults already set up there
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    //If no description let's just add the title
    if (trim($fb_desc) == '') {
        $fb_desc = $fb_title;
    }
    //YOAST?
    if ($fb_show_wpseoyoast == 1) {
        if (defined('WPSEO_VERSION')) {
            $wpseo = WPSEO_Frontend::get_instance();
            //App ID - From our plugin
            //Admin ID - From our plugin
            //Locale - From our plugin
            //Sitename - From our plugin
            //Title - From WPSEO
            $fb_title = strip_tags($wpseo->title(false));
            //Title - SubHeading plugin
            if ($fb_show_subheading == 1) {
                if (webdados_fb_open_graph_subheadingactive()) {
                    $fb_title .= ' - ' . get_the_subheading();
                }
            }
            //URL - From WPSEO
            $fb_url = $wpseo->canonical(false);
            //Description - From WPSEO or our plugin
            $fb_desc_temp = $wpseo->metadesc(false);
            $fb_desc = strip_tags(trim($fb_desc_temp) != '' ? trim($fb_desc_temp) : $fb_desc);
            //Image - From our plugin
        }
    }
    //WooCommerce - Additional product images?
    if (intval($fb_image_show) == 1 && class_exists('woocommerce') && $fb_wc_useproductgallery == 1 && is_product()) {
        global $post;
        $product = new WC_Product($post->ID);
        if ($attachment_ids = $product->get_gallery_attachment_ids()) {
            foreach ($attachment_ids as $attachment_id) {
                if ($image_link = wp_get_attachment_url($attachment_id)) {
                    if (trim($image_link) != '') {
                        $fb_image_additional[] = trim($image_link);
                    }
                }
            }
开发者ID:BetterDigitalServices,项目名称:bluearrow,代码行数:67,代码来源:wonderm00n-open-graph.php


示例2: disable_seo_on_escaped_fragment

 public function disable_seo_on_escaped_fragment()
 {
     if (!array_key_exists('_escaped_fragment_', $_GET) || !ecwid_page_has_productbrowser()) {
         return;
     }
     global $wpseo_front;
     // Canonical
     if (empty($wpseo_front)) {
         $wpseo_front = WPSEO_Frontend::get_instance();
     }
     remove_action('wpseo_head', array($wpseo_front, 'canonical'), 20);
     // Description
     remove_action('wpseo_head', array($wpseo_front, 'metadesc'), 10);
 }
开发者ID:johnmanlove,项目名称:Galveston_Island,代码行数:14,代码来源:class-ecwid-integration-wpseo.php


示例3: listing_og_description

 public static function listing_og_description($listing_id)
 {
     if (self::is_wp_seo_enabled()) {
         $wpseo_front = null;
         if (isset($GLOBALS['wpseo_front'])) {
             $wpseo_front = $GLOBALS['wpseo_front'];
         } elseif (class_exists('WPSEO_Frontend') && method_exists('WPSEO_Frontend', 'get_instance')) {
             $wpseo_front = WPSEO_Frontend::get_instance();
         }
         global $post;
         $prev_post = $post;
         $post = get_post($listing_id);
         $desc = $wpseo_front->metadesc(false);
         $post = $prev_post;
         return $desc;
     }
     $listing = WPBDP_Listing::get($listing_id);
     return $listing->get_field_value('excerpt');
 }
开发者ID:Nedick,项目名称:stzagora-website,代码行数:19,代码来源:seo.php


示例4: filter__title

 /**
  * Generate title
  *
  * @see get_title_from_options()
  * @scope front
  * @since 1.1.1		 
  *
  * @param string $text
  *
  * @return string
  */
 public static function filter__title($text)
 {
     $text = WPGlobus_Core::text_filter($text, WPGlobus::Config()->language);
     $wpseo_f = WPSEO_Frontend::get_instance();
     if (empty($text)) {
         global $post;
         $text = $post->post_title . ' ' . $wpseo_f->get_title_from_options('wpseo_titles');
     }
     return $text;
 }
开发者ID:rodica-andronache,项目名称:WPGlobus,代码行数:21,代码来源:class-wpglobus-wpseo.php


示例5: wpseo_init

 public function wpseo_init()
 {
     global $polylang;
     if (!defined('WPSEO_VERSION') || PLL_ADMIN) {
         return;
     }
     // reloads options once the language has been defined to enable translations
     // useful only when the language is set from content
     if (did_action('wp_loaded')) {
         if (version_compare(WPSEO_VERSION, '1.7.2', '<')) {
             global $wpseo_front;
         } else {
             $wpseo_front = WPSEO_Frontend::get_instance();
         }
         $options = version_compare(WPSEO_VERSION, '1.5', '<') ? get_wpseo_options_arr() : WPSEO_Options::get_option_names();
         foreach ($options as $opt) {
             $wpseo_front->options = array_merge($wpseo_front->options, (array) get_option($opt));
         }
     }
     // one sitemap per language when using multiple domains or subdomains
     // because WPSEO does not accept several domains or subdomains in one sitemap
     if ($polylang->options['force_lang'] > 1) {
         add_filter('wpseo_enable_xml_sitemap_transient_caching', '__return_false');
         // disable cache! otherwise WPSEO keeps only one domain
         add_filter('home_url', array(&$this, 'wpseo_home_url'), 10, 2);
         // fix home_url
         add_filter('wpseo_posts_join', array(&$this, 'wpseo_posts_join'), 10, 2);
         add_filter('wpseo_posts_where', array(&$this, 'wpseo_posts_where'), 10, 2);
         add_filter('wpseo_typecount_join', array(&$this, 'wpseo_posts_join'), 10, 2);
         add_filter('wpseo_typecount_where', array(&$this, 'wpseo_posts_where'), 10, 2);
     } else {
         add_filter('get_terms_args', array(&$this, 'wpseo_remove_terms_filter'));
     }
     add_filter('pll_home_url_white_list', create_function('$arr', "return array_merge(\$arr, array(array('file' => 'wordpress-seo')));"));
     add_action('wpseo_opengraph', array(&$this, 'wpseo_ogp'), 2);
 }
开发者ID:radabass,项目名称:polylang,代码行数:36,代码来源:plugins-compat.php


示例6: fallback_title

 /**
  * Returns the Twitter title for any page
  *
  * @return string
  */
 private function fallback_title()
 {
     return WPSEO_Frontend::get_instance()->title('');
 }
开发者ID:HealthStaffTraining,项目名称:healthstafftraining,代码行数:9,代码来源:class-twitter.php


示例7: test_twitter_url

 /**
  * @covers WPSEO_Twitter::url
  */
 public function test_twitter_url()
 {
     // create and go to post
     $post_id = $this->factory->post->create();
     $this->go_to(get_permalink($post_id));
     $expected = $this->metatag('url', esc_url(WPSEO_Frontend::get_instance()->canonical(false)));
     self::$class_instance->url();
     $this->expectOutput($expected);
 }
开发者ID:centre-for-effective-altruism,项目名称:wordpress-seo,代码行数:12,代码来源:test-class-twitter.php


示例8: description

 public function description()
 {
     $desc = wpseo_get_value('opengraph-description');
     if (!$desc) {
         $desc = WPSEO_Frontend::metadesc(false);
     }
     if ($desc && $desc != '') {
         echo "<meta property='og:description' content='" . esc_attr($desc) . "'/>\n";
     }
 }
开发者ID:Joshuwar,项目名称:Masterson,代码行数:10,代码来源:class-opengraph.php


示例9: wpto_remove_yoast_information

 public function wpto_remove_yoast_information()
 {
     if (!empty($this->wpto_options['remove_yoast_information'])) {
         if (defined('WPSEO_VERSION')) {
             $instance = WPSEO_Frontend::get_instance();
             remove_action('wpseo_head', array($instance, 'debug_marker'), 2);
             remove_action('wp_head', array($instance, 'head'), 1);
             add_action('wp_head', 'custom_yoast_head', 1);
             function custom_yoast_head()
             {
                 global $wp_query;
                 $old_wp_query = null;
                 if (!$wp_query->is_main_query()) {
                     $old_wp_query = $wp_query;
                     wp_reset_query();
                 }
                 do_action('wpseo_head');
                 if (!empty($old_wp_query)) {
                     $GLOBALS['wp_query'] = $old_wp_query;
                     unset($old_wp_query);
                 }
                 return;
             }
         }
     }
 }
开发者ID:dsgnr,项目名称:wp-theme-optimizer,代码行数:26,代码来源:class-wpto-public.php


示例10: 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 &amp; 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


示例11: foreach

foreach ($post_categories_array as $cats) {
    $cat = get_category($cats);
    if ($post_sections == '') {
        $post_sections .= $cat->name;
    } else {
        $post_sections .= ', ' . $cat->name;
    }
}
?>
            <meta itemprop="name headline" content="<?php 
the_title();
?>
" />
			<?php 
if (class_exists('WPSEO_Frontend')) {
    $wp_seo_object = WPSEO_Frontend::get_instance();
    $post_description = htmlentities($wp_seo_object->metadesc(false));
    echo '<meta itemprop="description" content="' . $post_description . '" />';
}
?>
			<meta itemprop="datePublished" content="<?php 
echo $post_date_iso;
?>
" />
			<span class="date published"><?php 
echo $post_date_iso;
?>
</span>
			<meta itemprop="dateModified" content="<?php 
echo $post_modified_date_iso;
?>
开发者ID:montreyw,项目名称:Theme-Redesign-and-SEO-Overhaul,代码行数:31,代码来源:single-gear_post.php


示例12: wp_head

 /**
 		@brief		Use the correct canonical link.
 	**/
 public function wp_head()
 {
     // Only override the canonical if we're looking at a single post.
     $override = false;
     $override |= is_single();
     $override |= is_page();
     if (!$override) {
         return;
     }
     global $post;
     global $blog_id;
     // Find the parent, if any.
     $broadcast_data = $this->get_post_broadcast_data($blog_id, $post->ID);
     $linked_parent = $broadcast_data->get_linked_parent();
     if ($linked_parent === false) {
         return;
     }
     // Post has a parent. Get the parent's permalink.
     switch_to_blog($linked_parent['blog_id']);
     $url = get_permalink($linked_parent['post_id']);
     restore_current_blog();
     echo sprintf('<link rel="canonical" href="%s" />', $url);
     echo "\n";
     // Prevent Wordpress from outputting its own canonical.
     remove_action('wp_head', 'rel_canonical');
     // Remove Canonical Link Added By Yoast WordPress SEO Plugin
     if (class_exists('\\WPSEO_Frontend')) {
         $this->add_filter('wpseo_canonical', 'wp_head_remove_wordpress_seo_canonical');
         $wpseo_frontend = \WPSEO_Frontend::get_instance();
         remove_action('wpseo_head', array($wpseo_frontend, 'canonical'), 20);
     }
 }
开发者ID:Garth619,项目名称:wines-by-jennifer,代码行数:35,代码来源:ThreeWP_Broadcast.php


示例13: ampforwp_update_metadata

function ampforwp_update_metadata($metadata, $post)
{
    global $redux_builder_amp;
    $structured_data_logo = $redux_builder_amp['amp-structured-data-logo']['url'];
    if ($structured_data_logo) {
        $structured_data_logo = $structured_data_logo;
    } else {
        $structured_data_logo = $redux_builder_amp['opt-media']['url'];
    }
    $metadata['publisher']['logo'] = array('@type' => 'ImageObject', 'url' => $structured_data_logo, 'height' => 36, 'width' => 190);
    //code for adding 'description' meta from Yoast SEO
    include_once ABSPATH . 'wp-admin/includes/plugin.php';
    if (is_plugin_active('wordpress-seo/wp-seo.php')) {
        $front = WPSEO_Frontend::get_instance();
        $desc = $front->metadesc(false);
        if ($desc) {
            $metadata['description'] = $desc;
        }
    }
    //End of code for adding 'description' meta from Yoast SEO
    return $metadata;
}
开发者ID:ahmedkaludi,项目名称:Accelerated-Mobile-Pages,代码行数:22,代码来源:features.php


示例14: test_twitter_description_metadesc

 /**
  * @covers WPSEO_Twitter::description
  */
 public function test_twitter_description_metadesc()
 {
     // create and go to post
     $post_id = $this->factory->post->create();
     // test wpseo meta
     WPSEO_Meta::set_value('metadesc', 'Meta description', $post_id);
     $this->go_to(get_permalink($post_id));
     $expected = $this->metatag('description', WPSEO_Frontend::get_instance()->metadesc(false));
     self::$class_instance->description();
     $this->expectOutput($expected);
 }
开发者ID:valeriosouza,项目名称:wordpress-seo,代码行数:14,代码来源:test-class-twitter.php


示例15: test_og_title

 /**
  * @covers WPSEO_OpenGraph::og_title
  */
 public function test_og_title()
 {
     // create and go to post
     $post_id = $this->factory->post->create();
     $this->go_to(get_permalink($post_id));
     $expected_title = WPSEO_Frontend::get_instance()->title('');
     $expected_html = '<meta property="og:title" content="' . $expected_title . '" />' . "\n";
     $this->assertTrue(self::$class_instance->og_title());
     $this->expectOutput($expected_html);
     $this->assertEquals(self::$class_instance->og_title(false), $expected_title);
 }
开发者ID:centre-for-effective-altruism,项目名称:wordpress-seo,代码行数:14,代码来源:test-class-opengraph.php


示例16: wpseo_init

 /**
  * Yoast SEO
  * Translate options and add specific filters and actions
  *
  * @since 1.6.4
  */
 public function wpseo_init()
 {
     if (!defined('WPSEO_VERSION') || PLL_ADMIN) {
         return;
     }
     // Reloads options once the language has been defined to enable translations
     // Useful only when the language is set from content
     if (did_action('wp_loaded')) {
         if (version_compare(WPSEO_VERSION, '1.7.2', '<')) {
             global $wpseo_front;
         } else {
             $wpseo_front = WPSEO_Frontend::get_instance();
         }
         $options = version_compare(WPSEO_VERSION, '1.5', '<') ? get_wpseo_options_arr() : WPSEO_Options::get_option_names();
         foreach ($options as $opt) {
             $wpseo_front->options = array_merge($wpseo_front->options, (array) get_option($opt));
         }
     }
     // One sitemap per language when using multiple domains or subdomains
     // because WPSEO does not accept several domains or subdomains in one sitemap
     if (PLL()->options['force_lang'] > 1) {
         add_filter('wpseo_enable_xml_sitemap_transient_caching', '__return_false');
         // disable cache! otherwise WPSEO keeps only one domain (thanks to Junaid Bhura)
         add_filter('home_url', array(&$this, 'wpseo_home_url'), 10, 2);
         // fix home_url
         add_filter('wpseo_posts_join', array(&$this, 'wpseo_posts_join'), 10, 2);
         add_filter('wpseo_posts_where', array(&$this, 'wpseo_posts_where'), 10, 2);
         add_filter('wpseo_typecount_join', array(&$this, 'wpseo_posts_join'), 10, 2);
         add_filter('wpseo_typecount_where', array(&$this, 'wpseo_posts_where'), 10, 2);
     } else {
         add_filter('get_terms_args', array(&$this, 'wpseo_remove_terms_filter'));
         // Add the homepages for all languages to the sitemap when the front page displays posts
         if (!get_option('page_on_front')) {
             add_filter('wpseo_sitemap_post_content', array(&$this, 'add_language_home_urls'));
         }
     }
     add_filter('pll_home_url_white_list', array(&$this, 'wpseo_home_url_white_list'));
     add_action('wpseo_opengraph', array(&$this, 'wpseo_ogp'), 2);
     add_filter('wpseo_canonical', array(&$this, 'wpseo_canonical'));
 }
开发者ID:spielhoelle,项目名称:amnesty,代码行数:46,代码来源:plugins-compat.php


示例17: url

 /**
  * Displays the URL for Twitter.
  *
  * Only used when OpenGraph is inactive.
  */
 protected function url()
 {
     /**
      * Filter: 'wpseo_twitter_url' - Allow changing the URL as output in the Twitter card by WP SEO
      *
      * @api string $unsigned Canonical URL
      */
     $url = apply_filters('wpseo_twitter_url', WPSEO_Frontend::get_instance()->canonical(false));
     if (is_string($url) && $url !== '') {
         $this->output_metatag('url', esc_url($url), true);
     }
 }
开发者ID:BennyHudson,项目名称:foundations,代码行数:17,代码来源:class-twitter.php


示例18: 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 &amp; 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


示例19: description

 public function description()
 {
     $ogdesc = wpseo_get_value('opengraph-description');
     if (!$ogdesc) {
         $ogdesc = WPSEO_Frontend::metadesc(false);
     }
     if ($ogdesc && $ogdesc != '') {
         echo "<meta property='og:description' content='" . esc_attr($ogdesc) . "'/>\n";
     }
     //
     // $gplusdesc = wpseo_get_value('google-plus-description');
     //
     // if ( !$gplusdesc )
     // 	$gplusdesc = WPSEO_Frontend::metadesc( false );
     //
     // if ( $gplusdesc && $gplusdesc != '' )
     // 	echo "<meta itemprop='description' content='".esc_attr( $gplusdesc )."'/>\n";
 }
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:18,代码来源:class-opengraph.php


示例20: 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()) {
         if (isset($this->options['og_frontpage_desc']) && $this->options['og_frontpage_desc'] !== '') {
             $ogdesc = wpseo_replace_vars($this->options['og_frontpage_desc'], null);
         } else {
             $ogdesc = WPSEO_Frontend::get_instance()->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 = WPSEO_Frontend::get_instance()->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('[&hellip;]', '&hellip;', strip_tags(get_the_excerpt()));
         }
     }
     if (is_category() || is_tag() || is_tax()) {
         $ogdesc = WPSEO_Frontend::get_instance()->metadesc(false);
         if ('' == $ogdesc) {
             $ogdesc = trim(strip_tags(term_description()));
         }
         if ('' == $ogdesc) {
             $term = $GLOBALS['wp_query']->get_queried_object();
             $ogdesc = WPSEO_Taxonomy_Meta::get_term_meta($term, $term->taxonomy, 'desc');
         }
     }
     // Strip shortcodes if any
     $ogdesc = strip_shortcodes($ogdesc);
     /**
      * Filter: 'wpseo_opengraph_desc' - Allow changing the OpenGraph description
      *
      * @api string $ogdesc The description string.
      */
     $ogdesc = trim(apply_filters('wpseo_opengraph 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP WPSEO_Meta类代码示例发布时间:2022-05-23
下一篇:
PHP WPSC_Purchase_Log类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap