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

PHP get_wpseo_options函数代码示例

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

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



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

示例1: __construct

 /**
  * Class constructor.
  */
 public function __construct()
 {
     $this->options = get_wpseo_options();
     global $fb_ver;
     if (isset($fb_ver) || class_exists('Facebook_Loader')) {
         add_filter('fb_meta_tags', array($this, 'facebook_filter'), 10, 1);
     } else {
         add_filter('language_attributes', array($this, 'add_opengraph_namespace'));
         add_action('wpseo_opengraph', array($this, 'locale'), 1);
         add_action('wpseo_opengraph', array($this, 'type'), 5);
         add_action('wpseo_opengraph', array($this, 'og_title'), 10);
         add_action('wpseo_opengraph', array($this, 'site_owner'), 20);
         add_action('wpseo_opengraph', array($this, 'description'), 11);
         add_action('wpseo_opengraph', array($this, 'url'), 12);
         add_action('wpseo_opengraph', array($this, 'site_name'), 13);
         add_action('wpseo_opengraph', array($this, 'website_facebook'), 14);
         add_action('wpseo_opengraph', array($this, 'article_author_facebook'), 15);
         add_action('wpseo_opengraph', array($this, 'tags'), 16);
         add_action('wpseo_opengraph', array($this, 'category'), 17);
         add_action('wpseo_opengraph', array($this, 'publish_date'), 19);
         add_action('wpseo_opengraph', array($this, 'image'), 30);
     }
     remove_action('wp_head', 'jetpack_og_tags');
     add_action('wpseo_head', array($this, 'opengraph'), 30);
 }
开发者ID:bulats,项目名称:chef,代码行数:28,代码来源:class-opengraph.php


示例2: __construct

 public function __construct()
 {
     $options = get_wpseo_options();
     add_action('wpseo_tab_header', array(&$this, 'tab_header'), 60);
     add_action('wpseo_tab_content', array(&$this, 'tab_content'));
     add_filter('wpseo_save_metaboxes', array(&$this, 'save_meta_boxes'), 10, 1);
 }
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:7,代码来源:class-opengraph-admin.php


示例3: query_vars

 /**
  * Update the query vars with the redirect var when stripcategorybase is active
  *
  * @param $query_vars
  * @return array
  */
 function query_vars($query_vars)
 {
     $options = get_wpseo_options();
     if (isset($options['stripcategorybase']) && $options['stripcategorybase']) {
         $query_vars[] = 'wpseo_category_redirect';
     }
     return $query_vars;
 }
开发者ID:macosxvn,项目名称:techheroes,代码行数:14,代码来源:class-rewrite.php


示例4: __construct

 public function __construct()
 {
     $this->options = get_wpseo_options();
     add_action('wpseo_head', array(&$this, 'opengraph'));
     if (isset($this->options['opengraph']) && $this->options['opengraph']) {
         add_filter('language_attributes', array(&$this, 'add_opengraph_namespace'));
     }
 }
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:8,代码来源:class-opengraph.php


示例5: WPSEO_Widgets

 function WPSEO_Widgets()
 {
     $options = get_wpseo_options();
     if (isset($options['replacemetawidget']) && $options['replacemetawidget'] == "on") {
         add_action('plugins_loaded', array(&$this, 'load_widgets'), 10);
         add_action('widgets_init', array(&$this, 'widgets_init'), 99);
     }
 }
开发者ID:kitfrench,项目名称:Futurestep,代码行数:8,代码来源:class-widgets.php


示例6: __construct

 function __construct()
 {
     if (!defined('ENT_XML1')) {
         define("ENT_XML1", 16);
     }
     add_action('init', array($this, 'init'), 1);
     add_action('template_redirect', array($this, 'redirect'));
     add_filter('redirect_canonical', array($this, 'canonical'));
     add_action('wpseo_hit_sitemap_index', array($this, 'hit_sitemap_index'));
     // default stylesheet
     $this->stylesheet = '<?xml-stylesheet type="text/xsl" href="' . home_url('main-sitemap.xsl') . '"?>';
     $this->options = get_wpseo_options();
 }
开发者ID:jeetututeja,项目名称:Ingenia,代码行数:13,代码来源:class-sitemaps.php


示例7: add_to_index

 /**
  * Adds active languages sitemap links to sitemap_index.xml 
  * @param type $str
  */
 function add_to_index($str)
 {
     global $sitepress, $sitepress_settings, $wpdb;
     $options = get_wpseo_options();
     $default_language = $sitepress->get_default_language();
     $current_language = $sitepress->get_current_language();
     foreach ($sitepress->get_active_languages() as $lang_code => $array) {
         if (isset($sitepress_settings['language_domains'][$lang_code])) {
             $home_url = $sitepress_settings['language_domains'][$lang_code];
         } else {
             $home_url = home_url();
         }
         foreach (get_post_types(array('public' => true)) as $post_type) {
             $sitepress->switch_lang($lang_code);
             $count = get_posts(array('post_type' => $post_type, 'post_status' => 'publish', 'suppress_filters' => 0));
             $sitepress->switch_lang($current_language);
             if (count($count) > 0 && $sitepress->is_translated_post_type($post_type)) {
                 if (!isset($options['post_types-' . $post_type . '-not_in_sitemap']) && $lang_code !== $default_language) {
                     $filename = $post_type . '-' . $lang_code . '-sitemap.xml';
                     $date = $this->get_last_mod_date($post_type, $lang_code);
                     $str .= '<sitemap>' . "\n";
                     $str .= '<loc>' . $home_url . '/' . $filename . '</loc>' . "\n";
                     $str .= '<lastmod>' . $date . '</lastmod>' . "\n";
                     $str .= '</sitemap>' . "\n";
                 }
             }
         }
         foreach (get_taxonomies(array('public' => true)) as $tax) {
             $sitepress->switch_lang($lang_code);
             $count = get_terms($tax, array('suppress_filters' => 0));
             $sitepress->switch_lang($current_language);
             if (count($count) > 0 && $sitepress->is_translated_taxonomy($tax)) {
                 if (!isset($options['taxonomies-' . $tax . '-not_in_sitemap']) && $lang_code !== $default_language) {
                     $filename = $tax . '-' . $lang_code . '-sitemap.xml';
                     $date = $this->get_last_mod_date('post', $lang_code);
                     $str .= '<sitemap>' . "\n";
                     $str .= '<loc>' . $home_url . '/' . $filename . '</loc>' . "\n";
                     $str .= '<lastmod>' . $date . '</lastmod>' . "\n";
                     $str .= '</sitemap>' . "\n";
                 }
             }
         }
     }
     return $str;
 }
开发者ID:santikrass,项目名称:apache,代码行数:49,代码来源:wpseo-sitemaps-filter.php


示例8: 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 = get_wpseo_options();
     if (isset($options['post_types-' . $post->post_type . '-not_in_sitemap']) && $options['post_types-' . $post->post_type . '-not_in_sitemap']) {
         return;
     }
     if (WP_CACHE) {
         wp_schedule_single_event(time(), '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_get_value('sitemap-include', $post->ID) != 'never') {
         wp_schedule_single_event(time() + 60, 'wpseo_ping_search_engines');
     }
 }
开发者ID:Savantos,项目名称:cow-theme,代码行数:24,代码来源:class-sitemaps-admin.php


示例9: modify_breadcrumb_element

 /**
  * This function modifies the output for a single breadcrumb.
  * 
  * The default output is not modified, instead a completely new output is generated.
  * If the default link output contains a rel attribute with the value 'v:url' (which is added by WordPress SEO for every but the last link), URL and text are output.
  * Otherwise it is the current page for which only the text is printed out.
  * 
  * In this method the Schema.org markup for a single breadcrumb is added, and the link counter (class variable) is increased by 1 (for each link).
  * 
  * @param string $link_output the default output created by the WordPress SEO plugin
  * @param array $link an array containing data for the breadcrumb link (with fields 'url' and 'text')
  * @return string the output for a single breadcrumb link
  */
 public function modify_breadcrumb_element($link_output, $link)
 {
     $output = '';
     if (isset($link['url']) && substr_count($link_output, 'rel="v:url"') > 0) {
         $output .= '<a href="' . esc_attr($link['url']) . '"><span itemprop="itemListElement">' . $link['text'] . '</span></a>';
     } else {
         $opt = array();
         if (class_exists('WPSEO_Options')) {
             $opt = WPSEO_Options::get_all();
         } else {
             $opt = get_wpseo_options();
         }
         if (isset($opt['breadcrumbs-boldlast']) && $opt['breadcrumbs-boldlast']) {
             $output .= '<strong class="breadcrumb_last" itemprop="itemListElement">' . $link['text'] . '</strong>';
         } else {
             $output .= '<span class="breadcrumb_last" itemprop="itemListElement">' . $link['text'] . '</span>';
         }
     }
     $this->breadcrumb_link_counter++;
     return $output;
 }
开发者ID:felixarntz,项目名称:schema-breadcrumbs-for-wordpress-seo,代码行数:34,代码来源:class.schema_breadcrumbs.php


示例10: term_additions_form

 function term_additions_form($term, $taxonomy)
 {
     $tax_meta = get_option('wpseo_taxonomy_meta');
     $options = get_wpseo_options();
     if (isset($tax_meta[$taxonomy][$term->term_id])) {
         $tax_meta = $tax_meta[$taxonomy][$term->term_id];
     }
     echo '<h3>Yoast WordPress SEO Settings</h3>';
     echo '<table class="form-table">';
     $this->form_row('wpseo_title', 'SEO Title', 'The SEO title is used on the archive page for this term.', $tax_meta);
     $this->form_row('wpseo_desc', 'SEO Description', 'The SEO description is used for the meta description on the archive page for this term.', $tax_meta);
     if (isset($options['usemetakeywords']) && $options['usemetakeywords']) {
         $this->form_row('wpseo_metakey', 'Meta Keywords', 'Meta keywords used on the archive page for this term.', $tax_meta);
     }
     $this->form_row('wpseo_canonical', 'Canonical', 'The canonical link is shown on the archive page for this term.', $tax_meta);
     $this->form_row('wpseo_bctitle', 'Breadcrumbs Title', 'The Breadcrumbs title is used in the breadcrumbs where this ' . $taxonomy . ' appears.', $tax_meta);
     $this->form_row('wpseo_noindex', 'Noindex this ' . $taxonomy, '', $tax_meta, 'checkbox');
     $this->form_row('wpseo_nofollow', 'Nofollow this ' . $taxonomy, '', $tax_meta, 'checkbox');
     $this->form_row('wpseo_sitemap_include', 'Include in sitemap?', '', $tax_meta, 'select', array("-" => __("Auto detect"), "always" => __("Always include"), "never" => __("Never include")));
     echo '</table>';
 }
开发者ID:kitfrench,项目名称:Futurestep,代码行数:21,代码来源:class-taxonomy.php


示例11: twitter

 /**
  * Outputs the Twitter Card code on singular pages.
  *
  * @return false Only shows on singular pages, false on non-singular pages.
  */
 public function twitter()
 {
     if (!is_singular()) {
         return false;
     }
     wp_reset_query();
     $this->type();
     $this->site_twitter();
     $this->site_domain();
     $this->author_twitter();
     // No need to show these when OpenGraph is also showing, as it'd be the same contents and Twitter
     // would fallback to OpenGraph anyway.
     $this->image();
     $options = get_wpseo_options();
     if (!isset($options['opengraph']) || !$options['opengraph']) {
         $this->twitter_description();
         $this->twitter_title();
         $this->twitter_url();
     }
     do_action('wpseo_twitter');
 }
开发者ID:Cbuffin,项目名称:COTLR,代码行数:26,代码来源:class-twitter.php


示例12: calculate_results

 /**
  * Calculate the page analysis results for post.
  *
  * @param object $post Post to calculate the results for.
  * @return array
  */
 function calculate_results($post)
 {
     $options = get_wpseo_options();
     if (!class_exists('DOMDocument')) {
         $result = new WP_Error('no-domdocument', sprintf(__("Your hosting environment does not support PHP's %sDocument Object Model%s.", 'wordpress-seo'), '<a href="http://php.net/manual/en/book.dom.php">', '</a>') . ' ' . __("To enjoy all the benefits of the page analysis feature, you'll need to (get your host to) install it.", 'wordpress-seo'));
         return $result;
     }
     if (!wpseo_get_value('focuskw', $post->ID)) {
         $result = new WP_Error('no-focuskw', sprintf(__('No focus keyword was set for this %s. If you do not set a focus keyword, no score can be calculated.', 'wordpress-seo'), $post->post_type));
         wpseo_set_value('linkdex', 0, $post->ID);
         return $result;
     }
     $results = array();
     $job = array();
     $sampleurl = get_sample_permalink($post);
     $job["pageUrl"] = preg_replace('/%(post|page)name%/', $sampleurl[1], $sampleurl[0]);
     $job["pageSlug"] = urldecode($post->post_name);
     $job["keyword"] = trim(wpseo_get_value('focuskw'));
     $job["keyword_folded"] = $this->strip_separators_and_fold($job["keyword"]);
     $job["post_id"] = $post->ID;
     $dom = new domDocument();
     $dom->strictErrorChecking = false;
     $dom->preserveWhiteSpace = false;
     @$dom->loadHTML($post->post_content);
     $xpath = new DOMXPath($dom);
     $statistics = new Yoast_TextStatistics();
     // Check if this focus keyword has been used already.
     $this->check_double_focus_keyword($job, $results);
     // Keyword
     $this->score_keyword($job['keyword'], $results);
     // Title
     if (wpseo_get_value('title')) {
         $job['title'] = wpseo_get_value('title');
     } else {
         if (isset($options['title-' . $post->post_type]) && $options['title-' . $post->post_type] != '') {
             $title_template = $options['title-' . $post->post_type];
         } else {
             $title_template = '%%title%% - %%sitename%%';
         }
         $job['title'] = wpseo_replace_vars($title_template, (array) $post);
     }
     $this->score_title($job, $results, $statistics);
     // Meta description
     $description = '';
     if (wpseo_get_value('metadesc')) {
         $description = wpseo_get_value('metadesc');
     } else {
         if (isset($options['metadesc-' . $post->post_type]) && !empty($options['metadesc-' . $post->post_type])) {
             $description = wpseo_replace_vars($options['metadesc-' . $post->post_type], (array) $post);
         }
     }
     $meta_length = apply_filters('wpseo_metadesc_length', 156, $post);
     $this->score_description($job, $results, $description, $statistics, $meta_length);
     unset($description);
     // Body
     $body = $this->get_body($post);
     $firstp = $this->get_first_paragraph($post);
     $this->score_body($job, $results, $body, $firstp, $statistics);
     unset($body);
     unset($firstp);
     // URL
     $this->score_url($job, $results, $statistics);
     // Headings
     $headings = $this->get_headings($post->post_content);
     $this->score_headings($job, $results, $headings);
     unset($headings);
     // Images
     $imgs = array();
     $imgs['count'] = substr_count($post->post_content, '<img');
     $imgs = $this->get_images_alt_text($post, $imgs);
     $this->score_images_alt_text($job, $results, $imgs);
     unset($imgs);
     // Anchors
     $anchors = $this->get_anchor_texts($xpath);
     $count = $this->get_anchor_count($xpath);
     $this->score_anchor_texts($job, $results, $anchors, $count);
     unset($anchors, $count, $dom);
     $results = apply_filters('wpseo_linkdex_results', $results, $job, $post);
     $this->aasort($results, 'val');
     $overall = 0;
     $overall_max = 0;
     foreach ($results as $result) {
         $overall += $result['val'];
         $overall_max += 9;
     }
     if ($overall < 1) {
         $overall = 1;
     }
     $score = round($overall / $overall_max * 100);
     wpseo_set_value('linkdex', absint($score), $post->ID);
     return $results;
 }
开发者ID:macosxvn,项目名称:techheroes,代码行数:98,代码来源:class-metabox.php


示例13: __construct

 /**
  * Class constructor
  *
  * Adds and removes a lot of filters.
  */
 function __construct()
 {
     $this->options = get_wpseo_options();
     add_action('wp_head', array($this, 'head'), 1);
     // The head function here calls action wpseo_head, to which we hook all our functionality
     add_action('wpseo_head', array($this, 'debug_marker'), 2);
     add_action('wpseo_head', array($this, 'robots'), 6);
     add_action('wpseo_head', array($this, 'metadesc'), 10);
     add_action('wpseo_head', array($this, 'metakeywords'), 11);
     add_action('wpseo_head', array($this, 'canonical'), 20);
     add_action('wpseo_head', array($this, 'adjacent_rel_links'), 21);
     add_action('wpseo_head', array($this, 'author'), 22);
     add_action('wpseo_head', array($this, 'publisher'), 23);
     add_action('wpseo_head', array($this, 'webmaster_tools_authentication'), 90);
     // Remove actions that we will handle through our wpseo_head call, and probably change the output of
     remove_action('wp_head', 'rel_canonical');
     remove_action('wp_head', 'index_rel_link');
     remove_action('wp_head', 'start_post_rel_link');
     remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
     add_filter('wp_title', array($this, 'title'), 15, 3);
     add_filter('thematic_doctitle', array($this, 'title'), 15);
     add_action('wp', array($this, 'page_redirect'), 99, 1);
     add_action('template_redirect', array($this, 'noindex_feed'));
     add_filter('loginout', array($this, 'nofollow_link'));
     add_filter('register', array($this, 'nofollow_link'));
     if (isset($this->options['hide-rsdlink']) && $this->options['hide-rsdlink']) {
         remove_action('wp_head', 'rsd_link');
     }
     if (isset($this->options['hide-wlwmanifest']) && $this->options['hide-wlwmanifest']) {
         remove_action('wp_head', 'wlwmanifest_link');
     }
     if (isset($this->options['hide-shortlink']) && $this->options['hide-shortlink']) {
         remove_action('wp_head', 'wp_shortlink_wp_head');
         remove_action('template_redirect', 'wp_shortlink_header');
     }
     if (isset($this->options['hide-feedlinks']) && $this->options['hide-feedlinks']) {
         // @todo: add option to display just normal feed and hide comment feed.
         remove_action('wp_head', 'feed_links', 2);
         remove_action('wp_head', 'feed_links_extra', 3);
     }
     if (isset($this->options['disable-date']) && $this->options['disable-date'] || isset($this->options['disable-author']) && $this->options['disable-author'] || isset($this->options['disable-post_formats']) && $this->options['disable-post_formats']) {
         add_action('wp', array($this, 'archive_redirect'));
     }
     if (isset($this->options['redirectattachment']) && $this->options['redirectattachment']) {
         add_action('template_redirect', array($this, 'attachment_redirect'), 1);
     }
     if (isset($this->options['trailingslash']) && $this->options['trailingslash']) {
         add_filter('user_trailingslashit', array($this, 'add_trailingslash'), 10, 2);
     }
     if (isset($this->options['cleanpermalinks']) && $this->options['cleanpermalinks']) {
         add_action('template_redirect', array($this, 'clean_permalink'), 1);
     }
     if (isset($this->options['cleanreplytocom']) && $this->options['cleanreplytocom']) {
         add_filter('comment_reply_link', array($this, 'remove_reply_to_com'));
     }
     add_filter('the_content_feed', array($this, 'embed_rssfooter'));
     add_filter('the_excerpt_rss', array($this, 'embed_rssfooter_excerpt'));
     if (isset($this->options['forcerewritetitle']) && $this->options['forcerewritetitle']) {
         add_action('get_header', array($this, 'force_rewrite_output_buffer'));
         add_action('wp_footer', array($this, 'flush_cache'));
     }
     if (isset($this->options['title_test']) && $this->options['title_test']) {
         add_filter('wpseo_title', array($this, 'title_test_helper'));
     }
     if (isset($_GET['replytocom'])) {
         remove_action('wp_head', 'wp_no_robots');
         add_action('template_redirect', array($this, 'replytocom_redirect'), 1);
     }
 }
开发者ID:hoonio,项目名称:PhoneAfrika,代码行数:74,代码来源:class-frontend.php


示例14: header

<?php

/**
 * @package Admin
 */
if (!defined('WPSEO_VERSION')) {
    header('HTTP/1.0 403 Forbidden');
    die;
}
global $wpseo_admin_pages;
$options = get_wpseo_options();
?>
<div class="wrap">
<?php 
if (isset($_GET['updated']) && $_GET['updated'] == 'true' || isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true') {
    $msg = __('Settings updated', 'wordpress-seo');
    echo '<div id="message" style="width:94%;" class="message updated"><p><strong>' . $msg . '.</strong></p></div>';
}
?>
<a href="http://yoast.com/">
	<div id="top yoast-icon" style="background: url('<?php 
echo WPSEO_URL;
?>
images/wordpress-SEO-32x32.png') no-repeat;"
		 class="icon32"><br/></div>
</a>

<h2 id="wpseo-title"><?php 
_e("Yoast WordPress SEO: Titles &amp; Metas", 'wordpress-seo');
?>
</h2>
开发者ID:jimlongo56,项目名称:bhouse,代码行数:31,代码来源:metas.php


示例15: build_tax_map

 /**
  * Build a sub-sitemap for a specific taxonomy -- example.com/tax-sitemap.xml
  *
  * @param string $taxonomy Registered taxonomy's slug
  */
 function build_tax_map($taxonomy)
 {
     $options = get_wpseo_options();
     if (isset($options['taxonomies-' . $taxonomy->name . '-not_in_sitemap']) && $options['taxonomies-' . $taxonomy->name . '-not_in_sitemap'] || in_array($taxonomy, array('link_category', 'nav_menu', 'post_format')) || apply_filters('wpseo_sitemap_exclude_taxonomy', false, $taxonomy->name)) {
         $this->bad_sitemap = true;
         return;
     }
     global $wpdb;
     $output = '';
     $steps = 25;
     $n = (int) get_query_var('sitemap_n');
     $offset = $n > 1 ? ($n - 1) * $this->max_entries : 0;
     $total = $offset + $this->max_entries;
     $terms = get_terms($taxonomy->name, array('hide_empty' => true));
     $terms = array_splice($terms, $offset, $steps);
     foreach ($terms as $c) {
         $url = array();
         if (wpseo_get_term_meta($c, $c->taxonomy, 'noindex') && !in_array(wpseo_get_term_meta($c, $c->taxonomy, 'sitemap_include'), array('always', '-'))) {
             continue;
         }
         if (wpseo_get_term_meta($c, $c->taxonomy, 'sitemap_include') == 'never') {
             continue;
         }
         $url['loc'] = wpseo_get_term_meta($c, $c->taxonomy, 'canonical');
         if (!$url['loc']) {
             $url['loc'] = get_term_link($c, $c->taxonomy);
             if (isset($options['trailingslash']) && $options['trailingslash']) {
                 $url['loc'] = trailingslashit($url['loc']);
             }
         }
         if ($c->count > 10) {
             $url['pri'] = 0.6;
         } else {
             if ($c->count > 3) {
                 $url['pri'] = 0.4;
             } else {
                 $url['pri'] = 0.2;
             }
         }
         // Grab last modified date
         $sql = $wpdb->prepare("SELECT MAX(p.post_modified_gmt) AS lastmod\n\t\t\t\t\tFROM\t{$wpdb->posts} AS p\n\t\t\t\t\tINNER JOIN {$wpdb->term_relationships} AS term_rel\n\t\t\t\t\tON\t\tterm_rel.object_id = p.ID\n\t\t\t\t\tINNER JOIN {$wpdb->term_taxonomy} AS term_tax\n\t\t\t\t\tON\t\tterm_tax.term_taxonomy_id = term_rel.term_taxonomy_id\n\t\t\t\t\tAND\t\tterm_tax.taxonomy = %s\n\t\t\t\t\tAND\t\tterm_tax.term_id = %d\n\t\t\t\t\tWHERE\tp.post_status IN ('publish','inherit')\n\t\t\t\t\tAND\t\tp.post_password = ''", $c->taxonomy, $c->term_id);
         $url['mod'] = $wpdb->get_var($sql);
         $url['chf'] = 'weekly';
         $output .= $this->sitemap_url($url);
     }
     if (empty($output)) {
         $this->bad_sitemap = true;
         return;
     }
     $this->sitemap = '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
     $this->sitemap .= 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" ';
     $this->sitemap .= 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
     $this->sitemap .= $output . '</urlset>';
 }
开发者ID:jimlongo56,项目名称:bhouse,代码行数:59,代码来源:class-sitemaps.php


示例16: create_breadcrumbs_string

 /**
  * Take the links array and return a full breadcrumb string.
  *
  * Each element of the links array can either have one of these keys:
  *       "id"            for post types;
  *    "ptarchive"  for a post type archive;
  *    "term"         for a taxonomy term.
  * If either of these 3 are set, the url and text are retrieved. If not, url and text have to be set.
  *
  * @link http://support.google.com/webmasters/bin/answer.py?hl=en&answer=185417 Google documentation on RDFA
  *
  * @param array  $links   The links that should be contained in the breadcrumb.
  * @param string $wrapper The wrapping element for the entire breadcrumb path.
  * @param string $element The wrapping element for each individual link.
  * @return string
  */
 function create_breadcrumbs_string($links, $wrapper = 'span', $element = 'span')
 {
     global $paged;
     $opt = get_wpseo_options();
     $sep = isset($opt['breadcrumbs-sep']) && $opt['breadcrumbs-sep'] != '' ? $opt['breadcrumbs-sep'] : '&raquo;';
     $output = '';
     foreach ($links as $i => $link) {
         if (!empty($output)) {
             $output .= " {$sep} ";
         }
         if (isset($link['id'])) {
             $link['url'] = get_permalink($link['id']);
             $link['text'] = wpseo_get_value('bctitle', $link['id']);
             if (empty($link['text'])) {
                 $link['text'] = strip_tags(get_the_title($link['id']));
             }
             $link['text'] = apply_filters('wp_seo_get_bc_title', $link['text'], $link['id']);
         }
         if (isset($link['term'])) {
             $bctitle = wpseo_get_term_meta($link['term'], $link['term']->taxonomy, 'bctitle');
             if (!$bctitle) {
                 $bctitle = $link['term']->name;
             }
             $link['url'] = get_term_link($link['term']);
             $link['text'] = $bctitle;
         }
         if (isset($link['ptarchive'])) {
             if (isset($opt['bctitle-ptarchive-' . $link['ptarchive']]) && '' != $opt['bctitle-ptarchive-' . $link['ptarchive']]) {
                 $archive_title = $opt['bctitle-ptarchive-' . $link['ptarchive']];
             } else {
                 $post_type_obj = get_post_type_object($link['ptarchive']);
                 $archive_title = $post_type_obj->labels->menu_name;
             }
             $link['url'] = get_post_type_archive_link($link['ptarchive']);
             $link['text'] = $archive_title;
         }
         $element = apply_filters('wpseo_breadcrumb_single_link_wrapper', $element);
         $link_output = '<' . $element . ' typeof="v:Breadcrumb">';
         if (isset($link['url']) && ($i < count($links) - 1 || $paged)) {
             $link_output .= '<a href="' . esc_attr($link['url']) . '" rel="v:url" property="v:title">' . $link['text'] . '</a>';
         } else {
             if (isset($opt['breadcrumbs-boldlast']) && $opt['breadcrumbs-boldlast']) {
                 $link_output .= '<strong class="breadcrumb_last" property="v:title">' . $link['text'] . '</strong>';
             } else {
                 $link_output .= '<span class="breadcrumb_last" property="v:title">' . $link['text'] . '</span>';
             }
         }
         $link_output .= '</' . $element . '>';
         $output .= apply_filters('wpseo_breadcrumb_single_link', $link_output, $link);
     }
     $id = apply_filters('wpseo_breadcrumb_output_id', false);
     if (!empty($id)) {
         $id = ' id="' . $id . '"';
     }
     $class = apply_filters('wpseo_breadcrumb_output_class', false);
     if (!empty($class)) {
         $class = ' class="' . $class . '"';
     }
     $wrapper = apply_filters('wpseo_breadcrumb_output_wrapper', $wrapper);
     return apply_filters('wpseo_breadcrumb_output', '<' . $wrapper . $id . $class . ' xmlns:v="http://rdf.data-vocabulary.org/#">' . $output . '</' . $wrapper . '>');
 }
开发者ID:batruji,项目名称:metareading,代码行数:77,代码来源:class-breadcrumbs.php


示例17: wpseo_sitemap_handler

/**
 * Generate an HTML sitemap
 *
 * @param array $atts The attributes passed to the shortcode.
 *
 * @return string
 */
function wpseo_sitemap_handler($atts)
{
    global $wpdb;
    $atts = shortcode_atts(array('authors' => true, 'pages' => true, 'posts' => true, 'archives' => true), $atts);
    $display_authors = $atts['authors'] === 'no' ? false : true;
    $display_pages = $atts['pages'] === 'no' ? false : true;
    $display_posts = $atts['posts'] === 'no' ? false : true;
    $display_archives = $atts['archives'] === 'no' ? false : true;
    $options = get_wpseo_options();
    // Delete the transient if any of these are no
    if ($display_authors === 'no' || $display_pages === 'no' || $display_posts === 'no') {
        delete_transient('html-sitemap');
    }
    // Get any existing copy of our transient data
    if (false !== ($output = get_transient('html-sitemap'))) {
        // $output .= 'CACHE'; // debug
        // return $output;
    }
    $output = '';
    // create author list
    if ($display_authors) {
        $output .= '<h2 id="authors">' . __('Authors', 'wordpress-seo') . '</h2><ul>';
        // use echo => false b/c shortcode format screws up
        $author_list = wp_list_authors(array('exclude_admin' => false, 'echo' => false));
        $output .= $author_list;
        $output .= '</ul>';
    }
    // create page list
    if ($display_pages) {
        $output .= '<h2 id="pages">' . __('Pages', 'wordpress-seo') . '</h2><ul>';
        // Some query magic to retrieve all pages that should be excluded, while preventing noindex pages that are set to
        // "always" include in HTML sitemap from being excluded.
        $exclude_query = "SELECT DISTINCT( post_id ) FROM {$wpdb->postmeta}\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE ( ( meta_key = '_yoast_wpseo_sitemap-html-include' AND meta_value = 'never' )\n\t\t\t\t\t\t\t\t\t\t\t\t  OR ( meta_key = '_yoast_wpseo_meta-robots-noindex' AND meta_value = 1 ) )\n\t\t\t\t\t\t\t\t\t\t\t\tAND post_id NOT IN\n\t\t\t\t\t\t\t\t\t\t\t\t\t( SELECT pm2.post_id FROM {$wpdb->postmeta} pm2\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE pm2.meta_key = '_yoast_wpseo_sitemap-html-include' AND pm2.meta_value = 'always')\n\t\t\t\t\t\t\t\t\t\t\t\tORDER BY post_id ASC";
        $excluded_pages = $wpdb->get_results($exclude_query);
        $exclude = array();
        foreach ($excluded_pages as $page) {
            $exclude[] = $page->post_id;
        }
        unset($excluded_pages, $page);
        /**
         * This filter allows excluding more pages should you wish to from the HTML sitemap.
         */
        $exclude = implode(',', apply_filters('wpseo_html_sitemap_page_exclude', $exclude));
        $page_list = wp_list_pages(array('exclude' => $exclude, 'title_li' => '', 'echo' => false));
        $output .= $page_list;
        $output .= '</ul>';
    }
    // create post list
    if ($display_posts) {
        $output .= '<h2 id="posts">' . __('Posts', 'wordpress-seo') . '</h2><ul>';
        // Add categories you'd like to exclude in the exclude here
        // possibly have this controlled by shortcode params
        $cats = get_categories('exclude=');
        foreach ($cats as $cat) {
            $output .= "<li><h3>" . $cat->cat_name . "</h3>";
            $output .= "<ul>";
            $args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => -1, 'cat' => $cat->cat_ID, 'meta_query' => array('relation' => 'OR', array('key' => '_yoast_wpseo_meta-robots-noindex', 'value' => '', 'compare' => 'NOT EXISTS'), array('key' => '_yoast_wpseo_meta-robots-noindex', 'value' => 1, 'compare' => '!='), array('key' => '_yoast_wpseo_sitemap-html-include', 'value' => 'always', 'compare' => '=')));
            $posts = get_posts($args);
            foreach ($posts as $post) {
                $category = get_the_category($post->ID);
                // Only display a post link once, even if it's in multiple categories
                if ($category[0]->cat_ID == $cat->cat_ID) {
                    $output .= '<li><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></li>';
                }
            }
            $output .= "</ul>";
            $output .= "</li>";
        }
    }
    $output .= '</ul>';
    // get all public non-builtin post types
    $args = array('public' => true, '_builtin' => false);
    $post_types = get_post_types($args, 'object');
    // create an noindex array of post types and taxonomies
    $noindex = array();
    foreach ($options as $key => $value) {
        if (strpos($key, 'noindex-') === 0 && $value == 'on') {
            $noindex[] = $key;
        }
    }
    // create custom post type list
    foreach ($post_types as $post_type) {
        if (!in_array('noindex-' . $post_type->name, $noindex)) {
            $output .= '<h2 id="' . $post_type->name . '">' . __($post_type->label, 'wordpress-seo') . '</h2><ul>';
            $output .= create_type_sitemap_template($post_type);
            $output .= '</ul>';
        }
    }
    // $output = '';
    // create archives list
    if ($display_archives) {
        $output .= '<h2 id="archives">' . __('Archives', 'wordpress-seo') . '</h2><ul>';
        foreach ($post_types as $post_type) {
//.........这里部分代码省略.........
开发者ID:uniquegel,项目名称:Feminnova,代码行数:101,代码来源:wpseo-functions.php


示例18: title

 private function title()
 {
     global $post, $wp_query;
     if (empty($post) && is_singular()) {
         $post = $wp_query->get_queried_object();
     }
     $options = get_wpseo_options();
     if (is_home() && 'posts' == get_option('show_on_front')) {
         if (isset($options['title-home']) && $options['title-home'] != '') {
             $title = wpseo_replace_vars($options['title-home'], array());
         } else {
             $title = get_bloginfo('name');
         }
     } else {
         if (is_home() && 'posts' != get_option('show_on_front')) {
             // For some reason, in some instances is_home returns true for the front page when page_for_posts is not set.
             if (get_option('page_for_posts') == 0) {
                 $post = get_post(get_option('page_on_front'));
             } else {
                 $post = get_post(get_option('page_for_posts'));
             }
             $fixed_title = wpseo_get_value('title');
             if ($fixed_title) {
                 $title = $fixed_title;
             } else {
                 if (isset($options['title-' . $post->post_type]) && !empty($options['title-' . $post->post_type])) {
                     $title = wpseo_replace_vars($options['title-' . $post->post_type], (array) $post);
                 } else {
                     $title = get_bloginfo('name');
                 }
             }
         } else {
             if (is_singular()) {
                 $fixed_title = wpseo_get_value('title');
                 if ($fixed_title) {
                     $title = $fixed_title;
                 } else {
                     if (isset($options['title-' . $post->post_type]) && !empty($options['title-' . $post->post_type])) {
                         $title = wpseo_replace_vars($options['title-' . $post->post_type], (array) $post);
                     } else {
                         $title = get_the_title();
                         $title = apply_filters('single_post_title', $title);
                     }
                 }
             } else {
                 if (is_category() || is_tag() || is_tax()) {
                     $term = $wp_query->get_queried_object();
                     $title = trim(wpseo_get_term_meta($term, $term->taxonomy, 'title'));
                     if (!$title || empty($title)) {
                         if (isset($options['title-' . $term->taxonomy]) && !empty($options['title-' . $term->taxonomy])) {
                             $title = wpseo_replace_vars($options['title-' . $term->taxonomy], (array) $term);
                         } else {
                             if (is_category()) {
                                 $title = single_cat_title('', false);
                             } else {
                                 if (is_tag()) {
                                     $title = single_tag_title('', false);
                                 } else {
                                     if (is_tax()) {
                                         if (function_exists('single_term_title')) {
                                             $title = single_term_title('', false);
                                         } else {
                                             $term = $wp_query->get_queried_object();
                                             $title = $term->name;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 } else {
                     if (is_search()) {
                         if (isset($options['title-search']) && !empty($options['title-search'])) {
                             $title = wpseo_replace_vars($options['title-search'], (array) $wp_query->get_queried_object());
                         } else {
                             $title = __('Search for "') . get_search_query() . '"';
                         }
                     } else {
                         if (is_author()) {
                             $author_id = get_query_var('author');
                             $title = get_the_author_meta('wpseo_title', $author_id);
                             if (empty($title)) {
                                 if (isset($options['title-author']) && !empty($options['title-author'])) {
                                     $title = wpseo_replace_vars($options['title-author'], array());
                                 } else {
                                     $title = get_the_author_meta('display_name', $author_id);
                                 }
                             }
                         } else {
                             if (is_post_type_archive()) {
                                 $post_type = get_post_type();
                                 if 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_wpseo_options_arr函数代码示例发布时间:2022-05-15
下一篇:
PHP get_wp_user_avatar_src函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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