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


PHP WPSEO_Utils::home_url方法代码示例

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


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

示例1: get_home_url

 /**
  * Get Home URL
  *
  * This has been moved from the constructor because wp_rewrite is not available on plugins_loaded in multisite.
  * It will now be requested on need and not on initialization.
  *
  * @return string
  */
 protected function get_home_url()
 {
     if (!isset(self::$home_url)) {
         self::$home_url = WPSEO_Utils::home_url();
     }
     return self::$home_url;
 }
开发者ID:rtroncoso,项目名称:MamaSabeBien,代码行数:15,代码来源:class-post-type-sitemap-provider.php

示例2: get_home_url

 /**
  * Get Home URL
  *
  * This has been moved from the constructor because wp_rewrite is not available on plugins_loaded in multisite.
  * It will now be requested on need and not on initialization.
  *
  * @return string
  */
 protected function get_home_url()
 {
     if (!isset($this->home_url)) {
         $this->home_url = WPSEO_Utils::home_url();
     }
     return $this->home_url;
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:15,代码来源:class-post-type-sitemap-provider.php

示例3: get_home_url

 /**
  * Retrieves the home URL
  *
  * @return string
  */
 private function get_home_url()
 {
     /**
      * Filter: 'wpseo_json_home_url' - Allows filtering of the home URL for Yoast SEO's JSON+LD output
      *
      * @api unsigned string
      */
     return apply_filters('wpseo_json_home_url', WPSEO_Utils::home_url());
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:14,代码来源:class-json-ld.php

示例4: generate_canonical

 /**
  * This function normally outputs the canonical but is also used in other places to retrieve
  * the canonical URL for the current page.
  *
  * @return void
  */
 private function generate_canonical()
 {
     $canonical = false;
     $canonical_override = false;
     // Set decent canonicals for homepage, singulars and taxonomy pages.
     if (is_singular()) {
         $obj = get_queried_object();
         $canonical = get_permalink($obj->ID);
         $this->canonical_unpaged = $canonical;
         $canonical_override = WPSEO_Meta::get_value('canonical');
         // Fix paginated pages canonical, but only if the page is truly paginated.
         if (get_query_var('page') > 1) {
             $num_pages = substr_count($obj->post_content, '<!--nextpage-->') + 1;
             if ($num_pages && get_query_var('page') <= $num_pages) {
                 if (!$GLOBALS['wp_rewrite']->using_permalinks()) {
                     $canonical = add_query_arg('page', get_query_var('page'), $canonical);
                 } else {
                     $canonical = user_trailingslashit(trailingslashit($canonical) . get_query_var('page'));
                 }
             }
         }
     } else {
         if (is_search()) {
             $search_query = get_search_query();
             // Regex catches case when /search/page/N without search term is itself mistaken for search term. R.
             if (!empty($search_query) && !preg_match('|^page/\\d+$|', $search_query)) {
                 $canonical = get_search_link();
             }
         } elseif (is_front_page()) {
             $canonical = WPSEO_Utils::home_url();
         } elseif ($this->is_posts_page()) {
             $posts_page_id = get_option('page_for_posts');
             $canonical = WPSEO_Meta::get_value('canonical', $posts_page_id);
             if (empty($canonical)) {
                 $canonical = get_permalink($posts_page_id);
             }
         } elseif (is_tax() || is_tag() || is_category()) {
             $term = get_queried_object();
             if (!empty($term) && !$this->is_multiple_terms_query()) {
                 $canonical_override = WPSEO_Taxonomy_Meta::get_term_meta($term, $term->taxonomy, 'canonical');
                 $term_link = get_term_link($term, $term->taxonomy);
                 if (!is_wp_error($term_link)) {
                     $canonical = $term_link;
                 }
             }
         } elseif (is_post_type_archive()) {
             $post_type = get_query_var('post_type');
             if (is_array($post_type)) {
                 $post_type = reset($post_type);
             }
             $canonical = get_post_type_archive_link($post_type);
         } elseif (is_author()) {
             $canonical = get_author_posts_url(get_query_var('author'), get_query_var('author_name'));
         } elseif (is_archive()) {
             if (is_date()) {
                 if (is_day()) {
                     $canonical = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day'));
                 } elseif (is_month()) {
                     $canonical = get_month_link(get_query_var('year'), get_query_var('monthnum'));
                 } elseif (is_year()) {
                     $canonical = get_year_link(get_query_var('year'));
                 }
             }
         }
         $this->canonical_unpaged = $canonical;
         if ($canonical && get_query_var('paged') > 1) {
             global $wp_rewrite;
             if (!$wp_rewrite->using_permalinks()) {
                 if (is_front_page()) {
                     $canonical = trailingslashit($canonical);
                 }
                 $canonical = add_query_arg('paged', get_query_var('paged'), $canonical);
             } else {
                 if (is_front_page()) {
                     $canonical = WPSEO_Sitemaps_Router::get_base_url('');
                 }
                 $canonical = user_trailingslashit(trailingslashit($canonical) . trailingslashit($wp_rewrite->pagination_base) . get_query_var('paged'));
             }
         }
     }
     $this->canonical_no_override = $canonical;
     if (is_string($canonical) && $canonical !== '') {
         // Force canonical links to be absolute, relative is NOT an option.
         if (WPSEO_Utils::is_url_relative($canonical) === true) {
             $canonical = $this->base_url($canonical);
         }
     }
     if (is_string($canonical_override) && $canonical_override !== '') {
         $canonical = $canonical_override;
     }
     /**
      * Filter: 'wpseo_canonical' - Allow filtering of the canonical URL put out by Yoast SEO
      *
      * @api string $canonical The canonical URL
//.........这里部分代码省略.........
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:101,代码来源:class-frontend.php

示例5: add_home_crumb

 /**
  * Add Homepage crumb to the crumbs property
  */
 private function add_home_crumb()
 {
     $this->add_predefined_crumb($this->options['breadcrumbs-home'], WPSEO_Utils::home_url(), true);
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:7,代码来源:class-breadcrumbs.php


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