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


PHP WPSEO_Meta::replace_meta方法代码示例

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


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

示例1: import_post_metas

 /**
  * Import the post meta values to Yoast SEO by replacing the wpSEO fields by Yoast SEO fields
  */
 private function import_post_metas()
 {
     WPSEO_Meta::replace_meta('_wpseo_edit_title', WPSEO_Meta::$meta_prefix . 'title', $this->replace);
     WPSEO_Meta::replace_meta('_wpseo_edit_description', WPSEO_Meta::$meta_prefix . 'metadesc', $this->replace);
     WPSEO_Meta::replace_meta('_wpseo_edit_keywords', WPSEO_Meta::$meta_prefix . 'keywords', $this->replace);
     WPSEO_Meta::replace_meta('_wpseo_edit_canonical', WPSEO_Meta::$meta_prefix . 'canonical', $this->replace);
     $this->import_post_robots();
 }
开发者ID:Didox,项目名称:beminfinito,代码行数:11,代码来源:class-import-wpseo.php

示例2: import_headspace

 /**
  * Import HeadSpace SEO settings
  */
 public function import_headspace()
 {
     global $wpdb;
     WPSEO_Meta::replace_meta('_headspace_description', WPSEO_Meta::$meta_prefix . 'metadesc', $this->replace);
     WPSEO_Meta::replace_meta('_headspace_keywords', WPSEO_Meta::$meta_prefix . 'metakeywords', $this->replace);
     WPSEO_Meta::replace_meta('_headspace_page_title', WPSEO_Meta::$meta_prefix . 'title', $this->replace);
     /**
      * @todo [JRF => whomever] verify how headspace sets these metas ( 'noindex', 'nofollow', 'noarchive', 'noodp', 'noydir' )
      * and if the values saved are concurrent with the ones we use (i.e. 0/1/2)
      */
     WPSEO_Meta::replace_meta('_headspace_noindex', WPSEO_Meta::$meta_prefix . 'meta-robots-noindex', $this->replace);
     WPSEO_Meta::replace_meta('_headspace_nofollow', WPSEO_Meta::$meta_prefix . 'meta-robots-nofollow', $this->replace);
     /*
      * @todo - [JRF => whomever] check if this can be done more efficiently by querying only the meta table
      * possibly directly changing it using concat on the existing values
      */
     $posts = $wpdb->get_results("SELECT ID FROM {$wpdb->posts}");
     if (is_array($posts) && $posts !== array()) {
         foreach ($posts as $post) {
             $custom = get_post_custom($post->ID);
             $robotsmeta_adv = '';
             if (isset($custom['_headspace_noarchive'])) {
                 $robotsmeta_adv .= 'noarchive,';
             }
             if (isset($custom['_headspace_noodp'])) {
                 $robotsmeta_adv .= 'noodp,';
             }
             if (isset($custom['_headspace_noydir'])) {
                 $robotsmeta_adv .= 'noydir';
             }
             $robotsmeta_adv = preg_replace('`,$`', '', $robotsmeta_adv);
             WPSEO_Meta::set_value('meta-robots-adv', $robotsmeta_adv, $post->ID);
         }
     }
     if ($this->replace) {
         $hs_meta = array('noarchive', 'noodp', 'noydir');
         foreach ($hs_meta as $meta) {
             delete_post_meta_by_key('_headspace_' . $meta);
         }
         unset($hs_meta, $meta);
     }
     $this->set_msg(__('HeadSpace2 data successfully imported', 'wordpress-seo'));
 }
开发者ID:healthcommcore,项目名称:osnap,代码行数:46,代码来源:class-import-external.php

示例3: replace_meta

/**
 * Used for imports, both in dashboard and import settings pages, this functions either copies
 * $old_metakey into $new_metakey or just plain replaces $old_metakey with $new_metakey
 *
 * @deprecated 1.5.0
 * @deprecated use WPSEO_Meta::replace_meta()
 * @see        WPSEO_Meta::replace_meta()
 *
 * @param string $old_metakey The old name of the meta value.
 * @param string $new_metakey The new name of the meta value, usually the WP SEO name.
 * @param bool   $replace     Whether to replace or to copy the values.
 */
function replace_meta($old_metakey, $new_metakey, $replace = false)
{
    _deprecated_function(__FUNCTION__, 'WPSEO 1.5.0', 'WPSEO_Meta::replace_meta()');
    WPSEO_Meta::replace_meta($old_metakey, $new_metakey, $replace);
}
开发者ID:presteege,项目名称:presteege.fr,代码行数:17,代码来源:wpseo-functions.php

示例4: unset

         }
         unset($meta);
     }
     $msg .= __('HeadSpace2 data successfully imported', 'wordpress-seo');
 }
 // @todo [JRF => whomever] how does this correlate with the routine on the dashboard page ? isn't one superfluous ?
 if (isset($_POST['wpseo']['importaioseo']) || isset($_GET['importaioseo'])) {
     WPSEO_Meta::replace_meta('_aioseop_description', WPSEO_Meta::$meta_prefix . 'metadesc', $replace);
     WPSEO_Meta::replace_meta('_aioseop_keywords', WPSEO_Meta::$meta_prefix . 'metakeywords', $replace);
     WPSEO_Meta::replace_meta('_aioseop_title', WPSEO_Meta::$meta_prefix . 'title', $replace);
     $msg .= __(sprintf('All in One SEO data successfully imported. Would you like to %sdisable the All in One SEO plugin%s.', '<a href="' . esc_url(admin_url('admin.php?page=wpseo_import&deactivate_aioseo=1')) . '">', '</a>'), 'wordpress-seo');
 }
 if (isset($_POST['wpseo']['importaioseoold'])) {
     WPSEO_Meta::replace_meta('description', WPSEO_Meta::$meta_prefix . 'metadesc', $replace);
     WPSEO_Meta::replace_meta('keywords', WPSEO_Meta::$meta_prefix . 'metakeywords', $replace);
     WPSEO_Meta::replace_meta('title', WPSEO_Meta::$meta_prefix . 'title', $replace);
     $msg .= __('All in One SEO (Old version) data successfully imported.', 'wordpress-seo');
 }
 if (isset($_POST['wpseo']['importrobotsmeta']) || isset($_GET['importrobotsmeta'])) {
     $posts = $wpdb->get_results("SELECT ID, robotsmeta FROM {$wpdb->posts}");
     if (is_array($posts) && $posts !== array()) {
         foreach ($posts as $post) {
             // sync all possible settings
             if ($post->robotsmeta) {
                 $pieces = explode(',', $post->robotsmeta);
                 foreach ($pieces as $meta) {
                     switch ($meta) {
                         case 'noindex':
                             WPSEO_Meta::set_value('meta-robots-noindex', '1', $post->ID);
                             break;
                         case 'index':
开发者ID:rinodung,项目名称:myfreetheme,代码行数:31,代码来源:import.php

示例5: import_metas

 /**
  * Import All In One SEO meta values
  */
 private function import_metas()
 {
     WPSEO_Meta::replace_meta('_aioseop_description', WPSEO_Meta::$meta_prefix . 'metadesc', $this->replace);
     WPSEO_Meta::replace_meta('_aioseop_keywords', WPSEO_Meta::$meta_prefix . 'metakeywords', $this->replace);
     WPSEO_Meta::replace_meta('_aioseop_title', WPSEO_Meta::$meta_prefix . 'title', $this->replace);
 }
开发者ID:goodbayscott,项目名称:wwr-temp,代码行数:9,代码来源:class-import-aioseo.php

示例6: import_metas

 /**
  * Import meta values if they're applicable
  */
 private function import_metas()
 {
     WPSEO_Meta::replace_meta('seo_follow', WPSEO_Meta::$meta_prefix . 'meta-robots-nofollow', $this->replace);
     WPSEO_Meta::replace_meta('seo_noindex', WPSEO_Meta::$meta_prefix . 'meta-robots-noindex', $this->replace);
     // If WooSEO is set to use the Woo titles, import those.
     if ('true' == get_option('seo_woo_wp_title')) {
         WPSEO_Meta::replace_meta('seo_title', WPSEO_Meta::$meta_prefix . 'title', $this->replace);
     }
     // If WooSEO is set to use the Woo meta descriptions, import those.
     if ('b' == get_option('seo_woo_meta_single_desc')) {
         WPSEO_Meta::replace_meta('seo_description', WPSEO_Meta::$meta_prefix . 'metadesc', $this->replace);
     }
     // If WooSEO is set to use the Woo meta keywords, import those.
     if ('b' == get_option('seo_woo_meta_single_key')) {
         WPSEO_Meta::replace_meta('seo_keywords', WPSEO_Meta::$meta_prefix . 'metakeywords', $this->replace);
     }
     foreach (array('seo_woo_wp_title', 'seo_woo_meta_single_desc', 'seo_woo_meta_single_key') as $option) {
         $this->perhaps_delete($option);
     }
 }
开发者ID:flasomm,项目名称:Montkailash,代码行数:23,代码来源:class-import-woothemes-seo.php


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