当前位置: 首页>>代码示例>>PHP>>正文


PHP WPSEO_Frontend::get_instance方法代码示例

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


在下文中一共展示了WPSEO_Frontend::get_instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例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: 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

示例7: 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 = '';
     $frontend = WPSEO_Frontend::get_instance();
     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 = $frontend->metadesc(false);
         }
     }
     $is_posts_page = $frontend->is_posts_page();
     if (is_singular() || $is_posts_page) {
         $post_id = $is_posts_page ? get_option('page_for_posts') : get_the_ID();
         $post = get_post($post_id);
         $ogdesc = WPSEO_Meta::get_value('opengraph-description', $post_id);
         // Replace Yoast SEO Variables.
         $ogdesc = wpseo_replace_vars($ogdesc, $post);
         // Use metadesc if $ogdesc is empty.
         if ($ogdesc === '') {
             $ogdesc = $frontend->metadesc(false);
         }
         // Tag 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_Taxonomy_Meta::get_meta_without_term('opengraph-description');
         if ($ogdesc === '') {
             $ogdesc = $frontend->metadesc(false);
         }
         if ($ogdesc === '') {
             $ogdesc = trim(strip_tags(term_description()));
         }
         if ($ogdesc === '') {
             $ogdesc = WPSEO_Taxonomy_Meta::get_meta_without_term('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_desc', $ogdesc));
     if (is_string($ogdesc) && $ogdesc !== '') {
         if ($echo !== false) {
             $this->og_tag('og:description', $ogdesc);
         }
     }
     return $ogdesc;
 }
开发者ID:yoast,项目名称:wordpress-seo,代码行数:61,代码来源:class-opengraph.php

示例8: 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

示例9: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     self::$class_instance = WPSEO_Frontend::get_instance();
 }
开发者ID:valeriosouza,项目名称:wordpress-seo,代码行数:4,代码来源:test-class-wpseo-frontend.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;
    $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();
    }
    $focuskw = '';
    $score = '';
    $seo_url = '';
    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);
        $score = '<div class="' . esc_attr('wpseo-score-icon') . ' adminbar-seo-score"></div>';
        $seo_url = get_edit_post_link($post->ID);
    }
    if (WPSEO_Taxonomy::is_term_edit($GLOBALS['pagenow'])) {
        $score = '<div class="' . esc_attr('wpseo-score-icon') . ' adminbar-seo-score"></div>';
        $seo_url = get_edit_tag_link(filter_input(INPUT_GET, 'tag_ID'), 'category');
    }
    // Never display notifications for network admin.
    $counter = '';
    if ($admin_menu) {
        $seo_url = get_admin_url(null, 'admin.php?page=' . WPSEO_Admin::PAGE_IDENTIFIER);
        if ('' === $score) {
            // Notification information.
            $notification_center = Yoast_Notification_Center::get();
            $notification_count = $notification_center->get_notification_count();
            $new_notifications = $notification_center->get_new_notifications();
            $new_notifications_count = count($new_notifications);
            if ($notification_count > 0) {
                // Always show Alerts page when clicking on the main link.
                $counter = sprintf(' <div class="wp-core-ui wp-ui-notification yoast-issue-counter">%d</div>', $notification_count);
            }
            if ($new_notifications_count) {
                $notification = sprintf(_n('You have a new issue concerning your SEO!', 'You have %d new issues concerning your SEO!', $new_notifications_count, 'wordpress-seo'), $new_notifications_count);
                $counter .= '<div class="yoast-issue-added">' . $notification . '</div>';
            }
        }
    }
    // Yoast Icon.
    $icon_svg = WPSEO_Utils::get_icon_svg();
    $title = '<div id="yoast-ab-icon" class="ab-item yoast-logo svg" style="background-image: url(\'' . $icon_svg . '\');"></div>';
    $wp_admin_bar->add_menu(array('id' => 'wpseo-menu', 'title' => $title . $score . $counter, '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')));
        }
    }
    // @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:SayenkoDesign,项目名称:ividf,代码行数:86,代码来源:wpseo-non-ajax-functions.php

示例11: 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_desc', $ogdesc));
     if (is_string($ogdesc) && $ogdesc !== '') {
         if ($echo !== false) {
             $this->og_tag('og:description', $ogdesc);
         }
     }
     return $ogdesc;
 }
开发者ID:goodbayscott,项目名称:wwr-temp,代码行数:55,代码来源:class-opengraph.php

示例12: initialize_wpseo_front

 /**
  * Wraps frontend class.
  */
 function initialize_wpseo_front()
 {
     WPSEO_Frontend::get_instance();
 }
开发者ID:presteege,项目名称:presteege.fr,代码行数:7,代码来源:wpseo-functions.php

示例13: 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

示例14: 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

示例15: 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


注:本文中的WPSEO_Frontend::get_instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。