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

PHP wpseo_get_value函数代码示例

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

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



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

示例1: _likebtn_og_get_description

function _likebtn_og_get_description()
{
    $description = null;
    if (function_exists('aioseop_get_version')) {
        $description = trim(get_post_meta(get_the_ID(), '_aioseop_description', true));
    } else {
        if (function_exists('wpseo_get_value')) {
            $description = wpseo_get_value('metadesc', get_the_ID());
        }
    }
    return empty($description) ? strip_tags(get_the_excerpt()) : $description;
}
开发者ID:pslorus,项目名称:WebsiteTinTuc,代码行数:12,代码来源:open_graph.php


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


示例3: page_title

 function page_title($postid)
 {
     $fixed_title = wpseo_get_value('title', $postid);
     if ($fixed_title) {
         return $fixed_title;
     } else {
         $post = get_post($postid);
         $options = get_wpseo_options();
         if (isset($options['title-' . $post->post_type]) && !empty($options['title-' . $post->post_type])) {
             return wpseo_replace_vars($options['title-' . $post->post_type], (array) $post);
         } else {
             return wpseo_replace_vars('%%title%%', (array) $post);
         }
     }
 }
开发者ID:kitfrench,项目名称:Futurestep,代码行数:15,代码来源:class-metabox.php


示例4: getTitle

 public function getTitle()
 {
     if ($this->title_is_loaded === false) {
         $this->title_is_loaded = true;
         if ($this->post_loaded || $this->category_loaded) {
             $this->loadTheQuery();
             ob_start();
             $object = $GLOBALS['wp_query']->get_queried_object();
             if (function_exists('get_plugin_data') !== true) {
                 require_once $this->wordpress_location . '/wp-admin/includes/plugin.php';
             }
             if (file_exists($this->wordpress_location . '/wp-content/plugins/wordpress-seo/wp-seo.php') === true) {
                 $arDataWpSeo = get_plugin_data($this->wordpress_location . '/wp-content/plugins/wordpress-seo/wp-seo.php');
                 if (isset($arDataWpSeo['Version']) === true) {
                     $isRecentWpSeoVersion = version_compare($arDataWpSeo['Version'], '1.5.0', '>=');
                     if ($isRecentWpSeoVersion === false) {
                         if ($this->post_loaded) {
                             if (function_exists('wpseo_get_value')) {
                                 $titleSeo = wpseo_get_value('title', $object->ID);
                             }
                         } elseif ($this->category_loaded) {
                             if (function_exists('wpseo_get_term_meta')) {
                                 $titleSeo = wpseo_get_term_meta($object, $object->taxonomy, 'title');
                             }
                         }
                     } else {
                         if ($this->post_loaded) {
                             if (method_exists('\\WPSEO_Meta', 'get_value')) {
                                 $titleSeo = \WPSEO_Meta::get_value('title', $object->ID);
                             }
                         } elseif ($this->category_loaded) {
                             if (method_exists('\\WPSEO_Taxonomy_Meta', 'get_term_meta')) {
                                 $titleSeo = \WPSEO_Taxonomy_Meta::get_term_meta($object, $object->taxonomy, 'title');
                             }
                         }
                     }
                 }
             }
             if (isset($titleSeo) === true) {
                 echo $titleSeo;
             } else {
                 the_title();
             }
             $this->title = ob_get_clean();
         }
     }
     return $this->title;
 }
开发者ID:cmoncy,项目名称:WordpressBundle,代码行数:48,代码来源:WordpressLoader.php


示例5: wpseo_replace_vars

/**
 * @param string $string the string to replace the variables in.
 * @param array  $args   the object some of the replacement values might come from, could be a post, taxonomy or term.
 * @param array  $omit   variables that should not be replaced by this function.
 * @return string
 */
function wpseo_replace_vars($string, $args, $omit = array())
{
    $args = (array) $args;
    $string = strip_tags($string);
    // Let's see if we can bail super early.
    if (strpos($string, '%%') === false) {
        return trim(preg_replace('/\\s+/u', ' ', $string));
    }
    global $sep;
    if (!isset($sep) || empty($sep)) {
        $sep = '-';
    }
    $simple_replacements = array('%%sep%%' => $sep, '%%sitename%%' => get_bloginfo('name'), '%%sitedesc%%' => get_bloginfo('description'), '%%currenttime%%' => date('H:i'), '%%currentdate%%' => date('M jS Y'), '%%currentmonth%%' => date('F'), '%%currentyear%%' => date('Y'));
    foreach ($simple_replacements as $var => $repl) {
        $string = str_replace($var, $repl, $string);
    }
    // Let's see if we can bail early.
    if (strpos($string, '%%') === false) {
        return trim(preg_replace('/\\s+/u', ' ', $string));
    }
    global $wp_query;
    $defaults = array('ID' => '', 'name' => '', 'post_author' => '', 'post_content' => '', 'post_date' => '', 'post_excerpt' => '', 'post_modified' => '', 'post_title' => '', 'taxonomy' => '', 'term_id' => '');
    if (isset($args['post_content'])) {
        $args['post_content'] = wpseo_strip_shortcode($args['post_content']);
    }
    if (isset($args['post_excerpt'])) {
        $args['post_excerpt'] = wpseo_strip_shortcode($args['post_excerpt']);
    }
    $r = (object) wp_parse_args($args, $defaults);
    $max_num_pages = 1;
    if (!is_single()) {
        $pagenum = get_query_var('paged');
        if ($pagenum === 0) {
            $pagenum = 1;
        }
        if (isset($wp_query->max_num_pages) && $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0) {
            $max_num_pages = $wp_query->max_num_pages;
        }
    } else {
        global $post;
        $pagenum = get_query_var('page');
        $max_num_pages = isset($post->post_content) ? substr_count($post->post_content, '<!--nextpage-->') : 1;
        if ($max_num_pages >= 1) {
            $max_num_pages++;
        }
    }
    // Let's do date first as it's a bit more work to get right.
    if ($r->post_date != '') {
        $date = mysql2date(get_option('date_format'), $r->post_date);
    } else {
        if (get_query_var('day') && get_query_var('day') != '') {
            $date = get_the_date();
        } else {
            if (single_month_title(' ', false) && single_month_title(' ', false) != '') {
                $date = single_month_title(' ', false);
            } else {
                if (get_query_var('year') != '') {
                    $date = get_query_var('year');
                } else {
                    $date = '';
                }
            }
        }
    }
    $replacements = array('%%date%%' => $date, '%%searchphrase%%' => esc_html(get_query_var('s')), '%%page%%' => $max_num_pages > 1 && $pagenum > 1 ? sprintf($sep . ' ' . __('Page %d of %d', 'wordpress-seo'), $pagenum, $max_num_pages) : '', '%%pagetotal%%' => $max_num_pages, '%%pagenumber%%' => $pagenum);
    if (isset($r->ID)) {
        $replacements = array_merge($replacements, array('%%caption%%' => $r->post_excerpt, '%%category%%' => wpseo_get_terms($r->ID, 'category'), '%%excerpt%%' => !empty($r->post_excerpt) ? strip_tags($r->post_excerpt) : utf8_encode(substr(strip_shortcodes(strip_tags(utf8_decode($r->post_content))), 0, 155)), '%%excerpt_only%%' => strip_tags($r->post_excerpt), '%%focuskw%%' => wpseo_get_value('focuskw', $r->ID), '%%id%%' => $r->ID, '%%modified%%' => mysql2date(get_option('date_format'), $r->post_modified), '%%name%%' => get_the_author_meta('display_name', !empty($r->post_author) ? $r->post_author : get_query_var('author')), '%%tag%%' => wpseo_get_terms($r->ID, 'post_tag'), '%%title%%' => stripslashes($r->post_title), '%%userid%%' => !empty($r->post_author) ? $r->post_author : get_query_var('author')));
    }
    if (!empty($r->taxonomy)) {
        $replacements = array_merge($replacements, array('%%category_description%%' => trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))), '%%tag_description%%' => trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))), '%%term_description%%' => trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))), '%%term_title%%' => $r->name));
    }
    foreach ($replacements as $var => $repl) {
        if (!in_array($var, $omit)) {
            $string = str_replace($var, $repl, $string);
        }
    }
    if (strpos($string, '%%') === false) {
        $string = preg_replace('/\\s+/u', ' ', $string);
        return trim($string);
    }
    if (isset($wp_query->query_vars['post_type']) && preg_match_all('/%%pt_([^%]+)%%/u', $string, $matches, PREG_SET_ORDER)) {
        $pt = get_post_type_object($wp_query->query_vars['post_type']);
        $pt_plural = $pt_singular = $pt->name;
        if (isset($pt->labels->singular_name)) {
            $pt_singular = $pt->labels->singular_name;
        }
        if (isset($pt->labels->name)) {
            $pt_plural = $pt->labels->name;
        }
        $string = str_replace('%%pt_single%%', $pt_singular, $string);
        $string = str_replace('%%pt_plural%%', $pt_plural, $string);
    }
    if (preg_match_all('/%%cf_([^%]+)%%/u', $string, $matches, PREG_SET_ORDER)) {
        global $post;
//.........这里部分代码省略.........
开发者ID:juslee,项目名称:e27,代码行数:101,代码来源:wpseo-functions.php


示例6: wpseo_metakey

 /**
  * wpseo_metakey function.
  * 
  * @access public
  * @return void
  */
 function wpseo_metakey()
 {
     return wpseo_get_value('metakey', woocommerce_get_page_id('shop'));
 }
开发者ID:hscale,项目名称:webento,代码行数:10,代码来源:class-wc-query.php


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


示例8: output

 function output($post)
 {
     global $wpseo_metabox;
     $options = get_wpseo_options();
     if (is_int($post)) {
         $post = get_post($post);
     }
     if (!$post) {
         return;
     }
     if (!class_exists('DOMDocument')) {
         $output = '<div class="wpseo_msg"><p><strong>' . __('Error') . ':</strong> ' . sprintf(__("your hosting environment does not support PHP's %sDocument Object Model%s."), '<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.") . '</p></div>';
         return $output;
     }
     if (!wpseo_get_value('focuskw')) {
         $output = '<div class="wpseo_msg"><p><strong>' . __('Error') . ':</strong> ' . __("you have not specified a focus keyword, you'll have to enter one, then save or update this post, before this report works.") . '</p></div>';
         return $output;
     }
     $output = '<div class="wpseo_msg"><p><strong>' . __('Note') . ':</strong> ' . __('to update this page analysis, save as draft or update and check this tab again') . '.</p></div>';
     $results = '';
     $job = array();
     $sampleurl = get_sample_permalink($post->ID);
     $job["pageUrl"] = str_replace('%postname%', $sampleurl[1], $sampleurl[0]);
     $job["pageSlug"] = urldecode($post->post_name);
     $job["keyword"] = wpseo_get_value('focuskw');
     $job["keyword_folded"] = $this->strip_separators_and_fold($job["keyword"]);
     $dom = new domDocument();
     $dom->strictErrorChecking = false;
     $dom->preserveWhiteSpace = false;
     @$dom->loadHTML($post->post_content);
     $xpath = new DOMXPath($dom);
     $statistics = new TextStatistics();
     // Keyword
     $this->ScoreKeyword($job, $results);
     // Title
     if (wpseo_get_value('title')) {
         $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%%';
         }
         $title = wpseo_replace_vars($title_template, (array) $post);
     }
     $this->ScoreTitle($job, $results, $title, $statistics);
     unset($title);
     // Meta description
     $description = '';
     if (wpseo_get_value('metadesc')) {
         $description = wpseo_get_value('metadesc');
     } else {
         if (isset($options['metadesc-' . $post->post_type]) && $options['metadesc-' . $post->post_type] != '') {
             $description = wpseo_replace_vars($options['metadesc-' . $post->post_type], (array) $post);
         }
     }
     $this->ScoreDescription($job, $results, $description, $wpseo_metabox->wpseo_meta_length, $statistics);
     unset($description);
     // Body
     $body = $this->GetBody($post);
     $firstp = $this->GetFirstParagraph($post);
     $this->ScoreBody($job, $results, $body, $firstp, $statistics);
     unset($body);
     unset($firstp);
     // URL
     $this->ScoreUrl($job, $results, $statistics);
     // Headings
     $headings = $this->GetHeadings($post->post_content);
     $this->ScoreHeadings($job, $results, $headings);
     unset($headings);
     // Images
     $alts = $this->GetImagesAltText($post->post_content);
     $imgs = $this->GetImageCount($dom, $xpath);
     $this->ScoreImagesAltText($job, $results, $alts, $imgs);
     unset($alts);
     unset($imgs);
     // Anchors
     $anchors = $this->GetAnchorTexts($dom, $xpath);
     $count = $this->GetAnchorCount($dom, $xpath);
     $this->ScoreAnchorTexts($job, $results, $anchors, $count);
     unset($anchors);
     unset($count);
     unset($dom);
     asort($results);
     $output .= '<table class="wpseoanalysis">';
     foreach ($results as $result) {
         $scoreval = substr($result, 0, 1);
         switch ($scoreval) {
             case 1:
             case 2:
             case 3:
                 $score = 'poor';
                 break;
             case 4:
             case 5:
             case 6:
                 $score = 'ok';
                 break;
             case 7:
             case 8:
//.........这里部分代码省略.........
开发者ID:Joshuwar,项目名称:Masterson,代码行数:101,代码来源:linkdex.php


示例9: 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'])) {
             $ogdesc = $this->options['og_frontpage_desc'];
         }
     }
     if (is_singular()) {
         $ogdesc = wpseo_get_value('opengraph-description');
         if (!$ogdesc) {
             $ogdesc = $this->metadesc(false);
         }
     }
     $ogdesc = apply_filters('wpseo_opengraph_desc', $ogdesc);
     if ($ogdesc && $ogdesc != '') {
         if ($echo !== false) {
             echo "<meta property='og:description' content='" . esc_attr($ogdesc) . "'/>\n";
         } else {
             return $ogdesc;
         }
     }
 }
开发者ID:jimlongo56,项目名称:bhouse,代码行数:29,代码来源:class-opengraph.php


示例10: head

 /**
  * Display the optional sources link elements in the <code>&lt;head&gt;</code>.
  */
 public function head()
 {
     if (is_singular()) {
         global $post;
         $meta_news_keywords = trim(wpseo_get_value('newssitemap-keywords', $post->ID));
         if (!empty($meta_news_keywords)) {
             echo '<meta name="news_keywords" content="' . $meta_news_keywords . '" />' . "\n";
         }
         $original_source = trim(wpseo_get_value('newssitemap-original', $post->ID));
         if (!empty($original_source)) {
             echo '<link rel="original-source" href="' . get_permalink($post->ID) . '" />' . "\n";
         } else {
             $sources = explode('|', $original_source);
             foreach ($sources as $source) {
                 echo '<link rel="original-source" href="' . $source . '" />' . "\n";
             }
         }
     }
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:22,代码来源:xml-news-sitemap-class.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'])) {
             $ogdesc = $this->options['og_frontpage_desc'];
         }
     }
     if (is_singular()) {
         $ogdesc = wpseo_get_value('opengraph-description');
         if (!$ogdesc) {
             $ogdesc = $this->metadesc(false);
         }
         // og:description is still blank so grab it from get_the_excerpt()
         if (!$ogdesc) {
             $ogdesc = strip_tags(get_the_excerpt());
         }
     }
     $ogdesc = apply_filters('wpseo_opengraph_desc', $ogdesc);
     if ($ogdesc && (is_string($ogdesc) && $ogdesc != '')) {
         if ($echo !== false) {
             echo '<meta property="og:description" content="' . esc_attr($ogdesc) . "\"/>\n";
         } else {
             return $ogdesc;
         }
     }
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:33,代码来源:class-opengraph.php


示例12: get_bc_title

 function get_bc_title($id_or_name, $type = 'post_type')
 {
     $bctitle = wpseo_get_value('bctitle', $id_or_name);
     return !empty($bctitle) ? $bctitle : strip_tags(get_the_title($id_or_name));
 }
开发者ID:kitfrench,项目名称:Futurestep,代码行数:5,代码来源:class-breadcrumbs.php


示例13: 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 = esc_attr(apply_filters('wpseo_breadcrumb_single_link_wrapper', $element));
         $link_output = '<' . $element . ' typeof="v:Breadcrumb">';
         if (isset($link['url']) && ($i < count($links) - 1 || $paged)) {
             // add for breadcrumb translation as all text was hard coded - September 25, 2013
             if ($link['text'] == 'Investment Managers' && ICL_LANGUAGE_CODE == 'fr') {
                 $link['text'] = 'Gestionnaies de Placements';
             }
             if ($link['text'] == 'Prices & Performance' && ICL_LANGUAGE_CODE == 'fr') {
                 $link['text'] = 'Prix et Rendement';
             }
             if ($link['text'] == 'Investment Solutions > Mutual Funds' && ICL_LANGUAGE_CODE == 'fr') {
                 $link['text'] = 'Solutions D\'Investissement > Fonds communs de placement';
             }
             $link_output .= '<a href="' . esc_url($link['url']) . '" rel="v:url" property="v:title">' . esc_html($link['text']) . '</a>';
         } else {
             if (isset($opt['breadcrumbs-boldlast']) && $opt['breadcrumbs-boldlast']) {
                 $link_output .= '<strong class="breadcrumb_last" property="v:title">' . esc_html($link['text']) . '</strong>';
             } else {
                 $link_output .= '<span class="breadcrumb_last" property="v:title">' . esc_html($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="' . esc_attr($id) . '"';
     }
     $class = apply_filters('wpseo_breadcrumb_output_class', false);
     if (!empty($class)) {
         $class = ' class="' . esc_attr($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:jimlongo56,项目名称:bhouse,代码行数:87,代码来源:class-breadcrumbs.php


示例14: 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, $wpseo_front, $post;
    if (is_object($wpseo_front)) {
        $url = $wpseo_front->canonical(false);
    } else {
        $url = '';
    }
    if (isset($post) && is_object($post)) {
        $focuskw = wpseo_get_value('focuskw', $post->ID);
    } else {
        $focuskw = '';
    }
    $wp_admin_bar->add_menu(array('id' => 'wpseo-menu', 'title' => __('SEO'), 'href' => get_admin_url('admin.php?page=wpseo_dashboard')));
    $wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-kwresearch', 'title' => __('Keyword Research'), '#'));
    $wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-adwordsexternal', 'title' => __('AdWords External'), 'href' => 'https://adwords.google.com/select/KeywordToolExternal', 'meta' => array('target' => '_blank')));
    $wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-googleinsights', 'title' => __('Google Insights'), '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'), 'href' => 'http://tools.seobook.com/keyword-tools/seobook/?keyword=' . urlencode($focuskw), 'meta' => array('target' => '_blank')));
    if (!is_admin()) {
        $cleanurl = preg_replace('/^https?%3A%2F%2F/', '', urlencode($url));
        $wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-analysis', 'title' => __('Analyze this page'), '#'));
        $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-inlinks-y', 'title' => __('Check Inlinks (Yahoo!)'), 'href' => 'https://siteexplorer.search.yahoo.com/search?p=' . $cleanurl . '&bwm=i&bwmo=d&bwmf=u', 'meta' => array('target' => '_blank')));
        $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-inlinks-ose', 'title' => __('Check Inlinks (OSE)'), 'href' => 'http://www.opensiteexplorer.org/' . str_replace('/', '%252F', preg_replace('/^https?:\\/\\//', '', $url)) . '/a!links', 'meta' => array('target' => '_blank')));
        $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-kwdensity', 'title' => __('Check Keyword Density'), 'href' => 'http://tools.davidnaylor.co.uk/keyworddensity/index.php?url=' . $url . '&keyword=' . urlencode($focuskw), 'meta' => array('target' => '_blank')));
        $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-cache', 'title' => __('Check Google Cache'), 'href' => 'http://webcache.googleusercontent.com/search?strip=1&q=cache:' . $url, 'meta' => array('target' => '_blank')));
        $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-header', 'title' => __('Check Headers'), 'href' => 'http://quixapp.com/headers/?r=' . urlencode($url), 'meta' => array('target' => '_blank')));
    }
    $admin_menu = false;
    if (function_exists('is_multisite') && is_multisite()) {
        $options = get_site_option('wpseo_ms');
        if (is_array($options) && isset($options['access']) && $options['access'] == 'superadmin') {
            if (is_super_admin()) {
                $admin_menu = true;
            } else {
                $admin_menu = false;
            }
        } else {
            if (current_user_can('level_7')) {
                $admin_menu = true;
            } else {
                $admin_menu = false;
            }
        }
    } else {
        if (current_user_can('level_7')) {
            $admin_menu = true;
        }
    }
    if ($admin_menu) {
        $wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-settings', 'title' => __('SEO Settings'), 'href' => admin_url('admin.php?page=wpseo_titles')));
        $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-titles', 'title' => __('Titles'), 'href' => admin_url('admin.php?page=wpseo_titles')));
        $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-indexation', 'title' => __('Indexation'), 'href' => admin_url('admin.php?page=wpseo_indexation')));
        $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-xml', 'title' => __('XML Sitemaps'), 'href' => admin_url('admin.php?page=wpseo_xml')));
        $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-permalinks', 'title' => __('Permalinks'), 'href' => admin_url('admin.php?page=wpseo_permalinks')));
        $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-internal-links', 'title' => __('Internal Links'), 'href' => admin_url('admin.php?page=wpseo_internal-links')));
        $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-rss', 'title' => __('RSS'), 'href' => admin_url('admin.php?page=wpseo_rss')));
    }
}
开发者ID:kitfrench,项目名称:Futurestep,代码行数:65,代码来源:wpseo-non-ajax-functions.php


示例15: wpseo_metakey

 /**
  * wpseo_metakey function.
  * Hooked into wpseo_ hook already, so no need for function_exist
  *
  * @access public
  * @return string
  */
 public function wpseo_metakey()
 {
     return wpseo_get_value('metakey', wc_get_page_id('shop'));
 }
开发者ID:Joaquinsemp,项目名称:patriestausado,代码行数:11,代码来源:class-wc-query.php


示例16: 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']) && !empty($this->options['og_frontpage_desc'])) {
             $ogdesc = $this->options['og_frontpage_desc'];
         } else {
             $ogdesc = $this->metadesc(false);
         }
     }
     if (is_singular()) {
         $ogdesc = wpseo_get_value('opengraph-description');
         if (!$ogdesc) {
             $ogdesc = $this->metadesc(false);
         }
         // og:description is still blank so grab it from get_the_excerpt()
         if (!$ogdesc) {
             $ogdesc = str_replace('[&hellip;]', '&hellip;', strip_tags(get_the_excerpt()));
         }
     }
     if (is_tax()) {
         $ogdesc = trim(strip_tags(term_description()));
     }
     $ogdesc = apply_filters('wpseo_opengraph_desc', $ogdesc);
     if ($ogdesc && (is_string($ogdesc) && $ogdesc != '')) {
         if ($echo !== false) {
             $this->og_tag('og:description', $ogdesc);
         }
     }
     return $ogdesc;
 }
开发者ID:bulats,项目名称:chef,代码行数:38,代码来源:class-opengraph.php


示例17: description

 /**
  * Output the OpenGraph description, specific OG description first, if not, grab the meta description.
  */
 public function description()
 {
     $ogdesc = wpseo_get_value('opengraph-description');
     if (!$ogdesc) {
         $ogdesc = $this->metadesc(false);
     }
     if ($ogdesc && $ogdesc != '') {
         echo "<meta property='og:description' content='" . esc_attr($ogdesc) . "'/>\n";
     }
 }
开发者ID:Savantos,项目名称:cow-theme,代码行数:13,代码来源:class-opengraph.php


示例18: wpseo_replace_vars

function wpseo_replace_vars($string, $args, $omit = array())
{
    $args = (array) $args;
    $string = strip_tags($string);
    // Let's see if we can bail super early.
    if (strpos($string, '%%') === false) {
        return trim(preg_replace('/\\s+/', ' ', $string));
    }
    $simple_replacements = array('%%sitename%%' => get_bloginfo('name'), '%%sitedesc%%' => get_bloginfo('description'), '%%currenttime%%' => date('H:i'), '%%currentdate%%' => date('M jS Y'), '%%currentmonth%%' => date('F'), '%%currentyear%%' => date('Y'));
    foreach ($simple_replacements as $var => $repl) {
        $string = str_replace($var, $repl, $string);
    }
    // Let's see if we can bail early.
    if (strpos($string, '%%') === false) {
        return trim(preg_replace('/\\s+/', ' ', $string));
    }
    global $wp_query;
    $defaults = array('ID' => '', 'name' => '', 'post_author' => '', 'post_content' => '', 'post_date' => '', 'post_content' => '', 'post_excerpt' => '', 'post_modified' => '', 'post_title' => '', 'taxonomy' => '', 'term_id' => '');
    $pagenum = get_query_var('paged');
    if ($pagenum === 0) {
        if ($wp_query->max_num_pages > 1) {
            $pagenum = 1;
        } else {
            $pagenum = '';
        }
    }
    if (isset($args['post_content'])) {
        $args['post_content'] = wpseo_strip_shortcode($args['post_content']);
    }
    if (isset($args['post_excerpt'])) {
        $args['post_excerpt'] = wpseo_strip_shortcode($args['post_excerpt']);
    }
    $r = (object) wp_parse_args($args, $defaults);
    // Only global $post on single's, otherwise some expressions will return wrong results.
    if (is_singular() || is_front_page() && 'posts' != get_option('show_on_front')) {
        global $post;
    }
    // Let's do date first as it's a bit more work to get right.
    if ($r->post_date != '') {
        $date = mysql2date(get_option('date_format'), $r->post_date);
    } else {
        if (get_query_var('day') && get_query_var('day') != '') {
            $date = get_the_date();
        } else {
            if (single_month_title(' ', false) && single_month_title(' ', false) != '') {
                $date = single_month_title(' ', false);
            } else {
                if (get_query_var('year') != '') {
                    $date = get_query_var('year');
                } else {
                    $date = '';
                }
            }
        }
    }
    $replacements = array('%%date%%' => $date, '%%title%%' => stripslashes($r->post_title), '%%excerpt%%' => !empty($r->post_excerpt) ? strip_tags($r->post_excerpt) : substr(strip_shortcodes(strip_tags($r->post_content)), 0, 155), '%%excerpt_only%%' => strip_tags($r->post_excerpt), '%%category%%' => wpseo_get_terms($r->ID, 'category'), '%%category_description%%' => !empty($r->taxonomy) ? trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))) : '', '%%tag_description%%' => !empty($r->taxonomy) ? trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))) : '', '%%term_description%%' => !empty($r->taxonomy) ? trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))) : '', '%%term_title%%' => $r->name, '%%focuskw%%' => wpseo_get_value('focuskw', $r->ID), '%%tag%%' => wpseo_get_terms($r->ID, 'post_tag'), '%%modified%%' => mysql2date(get_option('date_format'), $r->post_modified), '%%id%%' => $r->ID, '%%name%%' => get_the_author_meta('display_name', !empty($r->post_author) ? $r->post_author : get_query_var('author')), '%%userid%%' => !empty($r->post_author) ? $r->post_author : get_query_var('author'), '%%searchphrase%%' => esc_html(get_query_var('s')), '%%page%%' => get_query_var('paged') != 0 ? 'Page ' . get_query_var('paged') . ' of ' . $wp_query->max_num_pages : 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wpseo_load_textdomain函数代码示例发布时间:2022-05-23
下一篇:
PHP wpseo_get_term_meta函数代码示例发布时间: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