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


PHP wpseo_title_test函数代码示例

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


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

示例1: reset_defaults

 /**
  * Resets the site to the default WordPress SEO settings and runs a title test to check whether force rewrite needs to be on.
  */
 function reset_defaults()
 {
     foreach (get_wpseo_options_arr() as $opt) {
         delete_option($opt);
     }
     wpseo_defaults();
     wpseo_title_test();
 }
开发者ID:Savantos,项目名称:cow-theme,代码行数:11,代码来源:class-config.php

示例2: wpseo_defaults

/**
 * Set the default settings.
 *
 * This uses the currently available custom post types and taxonomies.
 */
function wpseo_defaults()
{
    $options = get_option('wpseo');
    if (!is_array($options)) {
        $opt = array('disableadvanced_meta' => 'on', 'version' => WPSEO_VERSION);
        update_option('wpseo', $opt);
        // Test theme on activate
        wpseo_description_test();
    } else {
        // Re-check theme on re-activate
        wpseo_description_test();
        return;
    }
    if (!is_array(get_option('wpseo_titles'))) {
        $opt = array('title-home' => '%%sitename%% %%page%% %%sep%% %%sitedesc%%', 'title-author' => sprintf(__('%s, Author at %s', 'wordpress-seo'), '%%name%%', '%%sitename%%') . ' %%page%% ', 'title-archive' => '%%date%% %%page%% %%sep%% %%sitename%%', 'title-search' => sprintf(__('You searched for %s', 'wordpress-seo'), '%%searchphrase%%') . ' %%page%% %%sep%% %%sitename%%', 'title-404' => __('Page Not Found', 'wordpress-seo') . ' %%sep%% %%sitename%%', 'noindex-archive' => 'on', 'noindex-post_format' => 'on');
        foreach (get_post_types(array('public' => true), 'objects') as $pt) {
            $opt['title-' . $pt->name] = '%%title%% %%page%% %%sep%% %%sitename%%';
            if ($pt->has_archive) {
                $opt['title-ptarchive-' . $pt->name] = sprintf(__('%s Archive', 'wordpress-seo'), '%%pt_plural%%') . ' %%page%% %%sep%% %%sitename%%';
            }
        }
        foreach (get_taxonomies(array('public' => true)) as $tax) {
            $opt['title-' . $tax] = sprintf(__('%s Archives', 'wordpress-seo'), '%%term_title%%') . ' %%page%% %%sep%% %%sitename%%';
        }
        update_option('wpseo_titles', $opt);
        wpseo_title_test();
    }
    if (!is_array(get_option('wpseo_xml'))) {
        $opt = array('enablexmlsitemap' => 'on', 'post_types-attachment-not_in_sitemap' => true);
        update_option('wpseo_xml', $opt);
    }
    if (!is_array(get_option('wpseo_social'))) {
        $opt = array('opengraph' => 'on');
        update_option('wpseo_social', $opt);
    }
    if (!is_array(get_option('wpseo_rss'))) {
        $opt = array('rssafter' => sprintf(__('The post %s appeared first on %s.', 'wordpress-seo'), '%%POSTLINK%%', '%%BLOGLINK%%'));
        update_option('wpseo_rss', $opt);
    }
    if (!is_array(get_option('wpseo_permalinks'))) {
        $opt = array('cleanslugs' => 'on');
        update_option('wpseo_permalinks', $opt);
    }
    // Force WooThemes to use WordPress SEO data.
    if (function_exists('woo_version_init')) {
        update_option('seo_woo_use_third_party_data', 'true');
    }
}
开发者ID:jeetututeja,项目名称:Ingenia,代码行数:53,代码来源:wpseo-non-ajax-functions.php

示例3: maybe_upgrade

 /**
  * Determine whether the wpseo option holds the current version, if it doesn't, run
  * the upgrade procedures.
  */
 function maybe_upgrade()
 {
     $options = get_option('wpseo');
     $current_version = isset($options['version']) ? $options['version'] : 0;
     if (version_compare($current_version, WPSEO_VERSION, '==')) {
         return;
     }
     delete_option('rewrite_rules');
     // <= 0.3.5: flush rewrite rules for new XML sitemaps
     if ($current_version == 0) {
         flush_rewrite_rules();
     }
     if (version_compare($current_version, '0.4.2', '<')) {
         $xml_opt = array();
         // Move XML Sitemap settings from general array to XML specific array, general settings first
         foreach (array('enablexmlsitemap', 'xml_include_images', 'xml_ping_google', 'xml_ping_bing', 'xml_ping_yahoo', 'xml_ping_ask', 'xmlnews_posttypes') as $opt) {
             if (isset($options[$opt])) {
                 $xml_opt[$opt] = $options[$opt];
                 unset($options[$opt]);
             }
         }
         // Per post type settings
         foreach (get_post_types() as $post_type) {
             if (in_array($post_type, array('revision', 'nav_menu_item', 'attachment'))) {
                 continue;
             }
             if (isset($options['post_types-' . $post_type . '-not_in_sitemap'])) {
                 $xml_opt['post_types-' . $post_type . '-not_in_sitemap'] = $options['post_types-' . $post_type . '-not_in_sitemap'];
                 unset($options['post_types-' . $post_type . '-not_in_sitemap']);
             }
         }
         // Per taxonomy settings
         foreach (get_taxonomies() as $taxonomy) {
             if (in_array($taxonomy, array('nav_menu', 'link_category', 'post_format'))) {
                 continue;
             }
             if (isset($options['taxonomies-' . $taxonomy . '-not_in_sitemap'])) {
                 $xml_opt['taxonomies-' . $taxonomy . '-not_in_sitemap'] = $options['taxonomies-' . $taxonomy . '-not_in_sitemap'];
                 unset($options['taxonomies-' . $taxonomy . '-not_in_sitemap']);
             }
         }
         if (get_option('wpseo_xml') === false) {
             update_option('wpseo_xml', $xml_opt);
         }
         unset($xml_opt);
         // Clean up other no longer used settings
         unset($options['wpseodir'], $options['wpseourl']);
     }
     if (version_compare($current_version, '1.0.2.2', '<')) {
         $opt = (array) get_option('wpseo_indexation');
         unset($opt['hideindexrel'], $opt['hidestartrel'], $opt['hideprevnextpostlink'], $opt['hidewpgenerator']);
         update_option('wpseo_indexation', $opt);
     }
     if (version_compare($current_version, '1.0.4', '<')) {
         $opt = (array) get_option('wpseo_indexation');
         $newopt = array('opengraph' => isset($opt['opengraph']) ? $opt['opengraph'] : '', 'fb_adminid' => isset($opt['fb_adminid']) ? $opt['fb_adminid'] : '', 'fb_appid' => isset($opt['fb_appid']) ? $opt['fb_appid'] : '');
         update_option('wpseo_social', $newopt);
         unset($opt['opengraph'], $opt['fb_pageid'], $opt['fb_adminid'], $opt['fb_appid']);
         update_option('wpseo_indexation', $opt);
     }
     if (version_compare($current_version, '1.2', '<')) {
         $opt = get_option('wpseo_indexation');
         $metaopt = get_option('wpseo_titles');
         $metaopt['noindex-author'] = isset($opt['noindexauthor']) ? $opt['noindexauthor'] : '';
         $metaopt['disable-author'] = isset($opt['disableauthor']) ? $opt['disableauthor'] : '';
         $metaopt['noindex-archive'] = isset($opt['noindexdate']) ? $opt['noindexdate'] : '';
         $metaopt['noindex-category'] = isset($opt['noindexcat']) ? $opt['noindexcat'] : '';
         $metaopt['noindex-post_tag'] = isset($opt['noindextag']) ? $opt['noindextag'] : '';
         $metaopt['noindex-post_format'] = isset($opt['noindexpostformat']) ? $opt['noindexpostformat'] : '';
         $metaopt['noindex-subpages'] = isset($opt['noindexsubpages']) ? $opt['noindexsubpages'] : '';
         $metaopt['hide-rsdlink'] = isset($opt['hidersdlink']) ? $opt['hidersdlink'] : '';
         $metaopt['hide-feedlinks'] = isset($opt['hidefeedlinks']) ? $opt['hidefeedlinks'] : '';
         $metaopt['hide-wlwmanifest'] = isset($opt['hidewlwmanifest']) ? $opt['hidewlwmanifest'] : '';
         $metaopt['hide-shortlink'] = isset($opt['hideshortlink']) ? $opt['hideshortlink'] : '';
         update_option('wpseo_titles', $metaopt);
         delete_option('wpseo_indexation');
         wpseo_title_test();
     }
     // Clean up the wrong wpseo options
     if (version_compare($current_version, '1.2.3', '<')) {
         $opt = get_option('wpseo');
         if (is_array($opt)) {
             foreach ($opt as $key => $val) {
                 if (!in_array($key, array('ignore_blog_public_warning', 'ignore_tour', 'ignore_page_comments', 'ignore_permalink', 'ms_defaults_set', 'version', 'disableadvanced_meta', 'googleverify', 'msverify', 'alexaverify'))) {
                     unset($opt[$key]);
                 }
             }
             update_option('wpseo', $opt);
             unset($opt);
         }
     }
     // Fix wrongness created by buggy version 1.2.2
     if (version_compare($current_version, '1.2.4', '<')) {
         $options = get_option('wpseo_titles');
         if (is_array($options) && isset($options['title-home']) && $options['title-home'] == '%%sitename%% - %%sitedesc%% - 12345') {
             $options['title-home'] = '%%sitename%% - %%sitedesc%%';
//.........这里部分代码省略.........
开发者ID:BGCX067,项目名称:eyesimple-svn-to-git,代码行数:101,代码来源:class-admin.php

示例4: wpseo_update_theme_complete_actions

/**
 * Abuse a filter to check if the current theme was updated and if so, test the updated theme
 * for the title and meta description tag
 *
 * @since 1.4.14
 *
 * @param   array   $update_actions
 * @param   mixed   $updated_theme
 * @return  array  $update_actions    Unchanged array
 */
function wpseo_update_theme_complete_actions( $update_actions, $updated_theme ) {
	$options = get_option( 'wpseo' );

	// Break if admin_notice already in place
	if ( ( ( isset( $options['theme_has_description'] ) && $options['theme_has_description'] === true ) || $options['theme_description_found'] !== '' ) && $options['ignore_meta_description_warning'] !== true ) {
		return $update_actions;
	}

	$theme = get_stylesheet();
	if ( is_object( $updated_theme ) ) {
		/* Bulk update and $updated_theme only contains info on which theme was last in the list
		   of updated themes, so go & test */
		wpseo_title_test();
		wpseo_description_test();
	}
	elseif ( $updated_theme === $theme ) {
		/* Single theme update for the active theme */
		wpseo_title_test();
		wpseo_description_test();
	}
	return $update_actions;
}
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:32,代码来源:wpseo-non-ajax-functions.php

示例5: initialize

 /**
  * Initialize some options on first install/activate/reset
  *
  * @static
  * @return void
  */
 public static function initialize()
 {
     /* Make sure title_test and description_test function are available even when called
        from the isolated activation */
     require_once WPSEO_PATH . 'inc/wpseo-non-ajax-functions.php';
     wpseo_title_test();
     wpseo_description_test();
     /* Force WooThemes to use WordPress SEO data. */
     if (function_exists('woo_version_init')) {
         update_option('seo_woo_use_third_party_data', 'true');
     }
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:18,代码来源:class-wpseo-options.php


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