本文整理汇总了PHP中WPSEO_Taxonomy_Meta类的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Taxonomy_Meta类的具体用法?PHP WPSEO_Taxonomy_Meta怎么用?PHP WPSEO_Taxonomy_Meta使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WPSEO_Taxonomy_Meta类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wpseo_metadesc
function wpseo_metadesc($metadesc)
{
if (empty($metadesc)) {
$tax_metadesc = WPSEO_Taxonomy_Meta::get_term_meta($this->term, $this->term->taxonomy, 'desc');
if (!empty($tax_metadesc)) {
return $tax_metadesc;
}
}
return $metadesc;
}
开发者ID:kaydwithers,项目名称:crossfittanjongpagar,代码行数:10,代码来源:yoast-seo.php
示例2: term_seo_form
/**
* Show the SEO inputs for term.
*
* @param object $term Term to show the edit boxes for.
*/
function term_seo_form($term)
{
global $wpseo_taxonomy;
$tax_meta = WPSEO_Taxonomy_Meta::get_term_meta((int) $term->term_id, $term->taxonomy);
echo '<h2>' . __('Local SEO Settings', 'yoast-local-seo') . '</h2>';
echo '<table class="form-table wpseo-local-taxonomy-form">';
echo '<tr class="form-field">';
echo '<th scope="row">';
echo '<label class="textinput" for="show_route_label">' . __('Custom marker', 'yoast-local-seo') . ':</label>';
echo '</th>';
echo '<td>';
echo '<img src="' . (isset($tax_meta['wpseo_local_custom_marker']) ? wp_get_attachment_url($tax_meta['wpseo_local_custom_marker']) : '') . '" id="custom_marker" />';
echo '<button class="set_custom_images button">' . __('Set custom marker image', 'yoast-local-seo') . '</button>';
echo '<p class="description">' . __('A custom marker can be set per category. If no marker is set here, the global marker will be used.', 'yoast-local-seo') . '</p>';
if (isset($tax_meta['wpseo_local_custom_marker']) && '' != $tax_meta['wpseo_local_custom_marker']) {
echo '<br /><button id="remove_marker">' . __('Remove marker', 'yoast-local-seo') . '</button>';
}
echo '<input type="hidden" id="hidden_custom_marker" name="wpseo_local_custom_marker" value="' . (isset($tax_meta['wpseo_local_custom_marker']) && $tax_meta['wpseo_local_custom_marker'] !== '' ? $tax_meta['wpseo_local_custom_marker'] : '') . '">';
//$wpseo_taxonomy->form_row( 'wpseo_local_custom_marker', '', '', $tax_meta, 'upload' );
echo '</td>';
echo '</tr>';
echo '</table>';
}
开发者ID:scottnkerr,项目名称:eeco,代码行数:28,代码来源:class-taxonomy.php
示例3: 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
示例4: wpseo_tax_adminbar_content_score
/**
* Returns the Content score element for the adminbar.
*
* @return string
*/
function wpseo_tax_adminbar_content_score()
{
$rating = 0;
if (is_tax() || is_category() || is_tag()) {
$rating = WPSEO_Taxonomy_Meta::get_meta_without_term('content_score');
}
return wpseo_adminbar_score($rating);
}
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:13,代码来源:wpseo-non-ajax-functions.php
示例5: wpseo_get_term_meta
/**
* Retrieve a taxonomy term's meta value.
*
* @deprecated 1.5.0
* @deprecated use WPSEO_Taxonomy_Meta::get_term_meta()
* @see WPSEO_Taxonomy_Meta::get_term_meta()
*
* @param string|object $term term to get the meta value for
* @param string $taxonomy name of the taxonomy to which the term is attached
* @param string $meta meta value to get
*
* @return void
*/
function wpseo_get_term_meta($term, $taxonomy, $meta)
{
_deprecated_function(__FUNCTION__, 'WPSEO 1.5.0', 'WPSEO_Taxonomy_Meta::get_term_meta()');
WPSEO_Taxonomy_Meta::get_term_meta($term, $taxonomy, $meta);
}
开发者ID:presteege,项目名称:presteege.fr,代码行数:18,代码来源:wpseo-functions.php
示例6: get_sitemap_links
/**
* Get set of sitemap link data.
*
* @param string $type Sitemap type.
* @param int $max_entries Entries per sitemap.
* @param int $current_page Current page of the sitemap.
*
* @return array
*/
public function get_sitemap_links($type, $max_entries, $current_page)
{
global $wpdb;
$links = array();
$taxonomy = get_taxonomy($type);
if ($taxonomy === false || !$this->is_valid_taxonomy($taxonomy->name) || !$taxonomy->public) {
return $links;
}
$options = $this->get_options();
$steps = $max_entries;
$offset = $current_page > 1 ? ($current_page - 1) * $max_entries : 0;
/** This filter is documented in inc/sitemaps/class-taxonomy-sitemap-provider.php */
$hide_empty = apply_filters('wpseo_sitemap_exclude_empty_terms', true, $taxonomy);
$terms = get_terms($taxonomy->name, array('hide_empty' => $hide_empty));
$terms = array_splice($terms, $offset, $steps);
if (empty($terms)) {
$terms = array();
}
// Grab last modified date.
$sql = "\n\t\t\tSELECT MAX(p.post_modified_gmt) AS lastmod\n\t\t\tFROM\t{$wpdb->posts} AS p\n\t\t\tINNER JOIN {$wpdb->term_relationships} AS term_rel\n\t\t\t\tON\t\tterm_rel.object_id = p.ID\n\t\t\tINNER JOIN {$wpdb->term_taxonomy} AS term_tax\n\t\t\t\tON\t\tterm_tax.term_taxonomy_id = term_rel.term_taxonomy_id\n\t\t\t\tAND\t\tterm_tax.taxonomy = %s\n\t\t\t\tAND\t\tterm_tax.term_id = %d\n\t\t\tWHERE\tp.post_status IN ('publish','inherit')\n\t\t\t\tAND\t\tp.post_password = ''\n\t\t";
foreach ($terms as $term) {
$url = array();
$tax_noindex = WPSEO_Taxonomy_Meta::get_term_meta($term, $term->taxonomy, 'noindex');
$tax_sitemap_inc = WPSEO_Taxonomy_Meta::get_term_meta($term, $term->taxonomy, 'sitemap_include');
if ($tax_noindex === 'noindex' && $tax_sitemap_inc !== 'always') {
continue;
}
if ($tax_sitemap_inc === 'never') {
continue;
}
$url['loc'] = WPSEO_Taxonomy_Meta::get_term_meta($term, $term->taxonomy, 'canonical');
if (!is_string($url['loc']) || $url['loc'] === '') {
$url['loc'] = get_term_link($term, $term->taxonomy);
if ($options['trailingslash'] === true) {
$url['loc'] = trailingslashit($url['loc']);
}
}
$url['mod'] = $wpdb->get_var($wpdb->prepare($sql, $term->taxonomy, $term->term_id));
$url['images'] = $this->get_image_parser()->get_term_images($term);
// Deprecated, kept for backwards data compat. R.
$url['chf'] = 'daily';
$url['pri'] = 1;
/** This filter is documented at inc/sitemaps/class-post-type-sitemap-provider.php */
$url = apply_filters('wpseo_sitemap_entry', $url, 'term', $term);
if (!empty($url)) {
$links[] = $url;
}
}
return $links;
}
开发者ID:rtroncoso,项目名称:MamaSabeBien,代码行数:59,代码来源:class-taxonomy-sitemap-provider.php
示例7: generate_metadesc
/**
* Generates the meta description text.
*/
private function generate_metadesc()
{
global $post, $wp_query;
$metadesc = '';
$metadesc_override = false;
$post_type = '';
$template = '';
if (is_object($post) && (isset($post->post_type) && $post->post_type !== '')) {
$post_type = $post->post_type;
}
if (is_singular()) {
if ($metadesc === '' && $post_type !== '' && isset($this->options['metadesc-' . $post_type])) {
$template = $this->options['metadesc-' . $post_type];
$term = $post;
}
$metadesc_override = WPSEO_Meta::get_value('metadesc');
} else {
if (is_search()) {
$metadesc = '';
} elseif ($this->is_home_posts_page()) {
$template = $this->options['metadesc-home-wpseo'];
$term = array();
if (empty($template)) {
$template = get_bloginfo('description');
}
} elseif ($this->is_posts_page()) {
$metadesc = WPSEO_Meta::get_value('metadesc', get_option('page_for_posts'));
if ($metadesc === '' && $post_type !== '' && isset($this->options['metadesc-' . $post_type])) {
$page = get_post(get_option('page_for_posts'));
$template = $this->options['metadesc-' . $post_type];
$term = $page;
}
} elseif ($this->is_home_static_page()) {
$metadesc = WPSEO_Meta::get_value('metadesc');
if ($metadesc === '' && $post_type !== '' && isset($this->options['metadesc-' . $post_type])) {
$template = $this->options['metadesc-' . $post_type];
}
} elseif (is_category() || is_tag() || is_tax()) {
$term = $wp_query->get_queried_object();
$metadesc_override = WPSEO_Taxonomy_Meta::get_term_meta($term, $term->taxonomy, 'desc');
if (is_object($term) && isset($term->taxonomy, $this->options['metadesc-tax-' . $term->taxonomy])) {
$template = $this->options['metadesc-tax-' . $term->taxonomy];
}
} elseif (is_author()) {
$author_id = get_query_var('author');
$metadesc = get_the_author_meta('wpseo_metadesc', $author_id);
if ((!is_string($metadesc) || $metadesc === '') && '' !== $this->options['metadesc-author-wpseo']) {
$template = $this->options['metadesc-author-wpseo'];
}
} elseif (is_post_type_archive()) {
$post_type = get_query_var('post_type');
if (is_array($post_type)) {
$post_type = reset($post_type);
}
if (isset($this->options['metadesc-ptarchive-' . $post_type])) {
$template = $this->options['metadesc-ptarchive-' . $post_type];
}
} elseif (is_archive()) {
$template = $this->options['metadesc-archive-wpseo'];
}
// If we're on a paginated page, and the template doesn't change for paginated pages, bail.
if ((!is_string($metadesc) || $metadesc === '') && get_query_var('paged') && get_query_var('paged') > 1 && $template !== '') {
if (strpos($template, '%%page') === false) {
$metadesc = '';
}
}
}
$post_data = $post;
if (is_string($metadesc_override) && '' !== $metadesc_override) {
$metadesc = $metadesc_override;
if (isset($term)) {
$post_data = $term;
}
} else {
if ((!is_string($metadesc) || '' === $metadesc) && '' !== $template) {
if (!isset($term)) {
$term = $wp_query->get_queried_object();
}
$metadesc = $template;
$post_data = $term;
}
}
$metadesc = wpseo_replace_vars($metadesc, $post_data);
/**
* Filter: 'wpseo_metadesc' - Allow changing the WP SEO meta description sentence.
*
* @api string $metadesc The description sentence.
*/
$this->metadesc = apply_filters('wpseo_metadesc', trim($metadesc));
}
开发者ID:shellygraham,项目名称:livestock-framing,代码行数:93,代码来源:class-frontend.php
示例8: update_video_term_meta
/**
* Check and, if applicable, update video details for a term description
*
* @since 1.3
*
* @param object $term The term to check the description and possibly update the video details for.
* @param boolean $echo Whether or not to echo the performed actions.
*
* @return mixed $vid The video array that was just stored, or "none" if nothing was stored
* or false if not applicable.
*/
public function update_video_term_meta($term, $echo = false)
{
$options = array_merge(WPSEO_Options::get_all(), get_option('wpseo_video'));
if (!is_array($options['videositemap_taxonomies']) || $options['videositemap_taxonomies'] === array()) {
return false;
}
if (!in_array($term->taxonomy, $options['videositemap_taxonomies'])) {
return false;
}
$tax_meta = get_option('wpseo_taxonomy_meta');
$old_vid = array();
if (!isset($_POST['force'])) {
if (isset($tax_meta[$term->taxonomy]['_video'][$term->term_id])) {
$old_vid = $tax_meta[$term->taxonomy]['_video'][$term->term_id];
}
}
$vid = array();
$title = WPSEO_Taxonomy_Meta::get_term_meta($term->term_id, $term->taxonomy, 'wpseo_title');
if (empty($title) && isset($options['title-' . $term->taxonomy]) && $options['title-' . $term->taxonomy] !== '') {
$title = wpseo_replace_vars($options['title-' . $term->taxonomy], (array) $term);
}
if (empty($title)) {
$title = $term->name;
}
$vid['title'] = htmlspecialchars($title);
$vid['description'] = WPSEO_Taxonomy_Meta::get_term_meta($term->term_id, $term->taxonomy, 'wpseo_metadesc');
if (!$vid['description']) {
$vid['description'] = esc_attr(preg_replace('`\\s+`', ' ', wp_html_excerpt($this->strip_shortcodes(get_term_field('description', $term->term_id, $term->taxonomy)), 300)));
}
$vid['publication_date'] = date('Y-m-d\\TH:i:s+00:00');
// concatenate genesis intro text and term description to index the videos for both
$genesis_term_meta = get_option('genesis-term-meta');
$content = '';
if (isset($genesis_term_meta[$term->term_id]['intro_text']) && $genesis_term_meta[$term->term_id]['intro_text']) {
$content .= $genesis_term_meta[$term->term_id]['intro_text'];
}
$content .= "\n" . $term->description;
$content = stripslashes($content);
$vid = $this->index_content($content, $vid, $old_vid, null);
if ($vid != 'none') {
$tax_meta[$term->taxonomy]['_video'][$term->term_id] = $vid;
// Don't bother with the complete tax meta validation
$tax_meta['wpseo_already_validated'] = true;
update_option('wpseo_taxonomy_meta', $tax_meta);
if ($echo) {
$link = get_term_link($term);
if (!is_wp_error($link)) {
echo 'Updated <a href="' . esc_url($link) . '">' . esc_html($vid['title']) . '</a> - ' . esc_html($vid['type']) . '<br/>';
}
}
}
return $vid;
}
开发者ID:bitrecruiter,项目名称:wordpress-stackable,代码行数:64,代码来源:video-seo.php
示例9: update_term
/**
* Update the taxonomy meta data on save.
*
* @param int $term_id ID of the term to save data for.
* @param int $tt_id The taxonomy_term_id for the term.
* @param string $taxonomy The taxonomy the term belongs to.
*/
public function update_term($term_id, $tt_id, $taxonomy)
{
/* Create post array with only our values */
$new_meta_data = array();
foreach (WPSEO_Taxonomy_Meta::$defaults_per_term as $key => $default) {
if ($posted_value = filter_input(INPUT_POST, $key)) {
$new_meta_data[$key] = $posted_value;
}
}
unset($key, $default);
// Saving the values.
WPSEO_Taxonomy_Meta::set_values($term_id, $taxonomy, $new_meta_data);
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:20,代码来源:class-taxonomy.php
示例10: taxonomy_image_output
/**
* @return bool
*/
private function taxonomy_image_output()
{
foreach (array('twitter-image', 'opengraph-image') as $tag) {
$img = WPSEO_Taxonomy_Meta::get_meta_without_term($tag);
if ($img !== '') {
$this->image_output($img);
return true;
}
}
return false;
}
开发者ID:Garth619,项目名称:Femi9,代码行数:14,代码来源:class-twitter.php
示例11: ajax_get_term_keyword_usage
/**
* Retrieves the keyword for the keyword doubles of the termpages.
*/
function ajax_get_term_keyword_usage()
{
$post_id = filter_input(INPUT_POST, 'post_id');
$keyword = filter_input(INPUT_POST, 'keyword');
$taxonomy = filter_input(INPUT_POST, 'taxonomy');
if (!current_user_can('edit_terms')) {
die('-1');
}
$usage = WPSEO_Taxonomy_Meta::get_keyword_usage($keyword, $post_id, $taxonomy);
// Normalize the result so it it the same as the post keyword usage AJAX request.
$usage = $usage[$keyword];
wp_die(WPSEO_Utils::json_encode($usage));
}
开发者ID:designomx,项目名称:DMXFrmwrk,代码行数:16,代码来源:ajax.php
示例12: wpseo_local_get_custom_marker
/**
* Get the custom marker from categories or general Local SEO settings.
*
* @param $post_id Int the post id
* @param $taxonomy String The taxonomy name from the location category
*/
function wpseo_local_get_custom_marker($post_id = null, $taxonomy = '')
{
$custom_marker = '';
if (!empty($post_id) && !empty($taxonomy)) {
$terms = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'ids'));
$terms = apply_filters('wpseo_local_custom_marker_order', $terms);
if (!empty($terms)) {
foreach ($terms as $term_id) {
$tax_meta = WPSEO_Taxonomy_Meta::get_term_meta((int) $term_id, $taxonomy);
if (isset($tax_meta['wpseo_local_custom_marker']) && !empty($tax_meta['wpseo_local_custom_marker'])) {
$custom_marker = wp_get_attachment_url($tax_meta['wpseo_local_custom_marker']);
}
break;
}
}
} else {
$options = get_option('wpseo_local');
if (isset($options['custom_marker']) && intval($options['custom_marker'])) {
$custom_marker = wp_get_attachment_url($options['custom_marker']);
}
}
return $custom_marker;
}
开发者ID:scottnkerr,项目名称:eeco,代码行数:29,代码来源:wpseo-local-functions.php
示例13: get_meta_value
/**
* Returns the meta value for the given $meta_key.
*
* @param string $meta_key The target key that will be fetched.
*
* @return string
*/
private function get_meta_value($meta_key)
{
if (is_singular()) {
return WPSEO_Meta::get_value($meta_key);
}
if (is_category() || is_tag() || is_tax()) {
return WPSEO_Taxonomy_Meta::get_meta_without_term($meta_key);
}
return '';
}
开发者ID:Didox,项目名称:beminfinito,代码行数:17,代码来源:class-googleplus.php
示例14: ajax_get_term_keyword_usage
/**
* Retrieves the keyword for the keyword doubles of the termpages.
*/
function ajax_get_term_keyword_usage()
{
$post_id = filter_input(INPUT_POST, 'post_id');
$keyword = filter_input(INPUT_POST, 'keyword');
$taxonomy = filter_input(INPUT_POST, 'taxonomy');
wp_die(WPSEO_Utils::json_encode(WPSEO_Taxonomy_Meta::get_keyword_usage($keyword, $post_id, $taxonomy)));
}
开发者ID:healthcommcore,项目名称:osnap,代码行数:10,代码来源:ajax.php
示例15: _meta_keywords
public function _meta_keywords()
{
$wpseo_front = null;
if (isset($GLOBALS['wpseo_front'])) {
$wpseo_front = $GLOBALS['wpseo_front'];
} elseif (class_exists('WPSEO_Frontend') && method_exists('WPSEO_Frontend', 'get_instance')) {
$wpseo_front = WPSEO_Frontend::get_instance();
}
$current_action = $this->controller->get_current_action();
switch ($current_action) {
case 'showlisting':
global $post;
$listing_id = get_query_var('listing') ? wpbdp_get_post_by_slug(get_query_var('listing'))->ID : wpbdp_getv($_GET, 'id', get_query_var('id'));
$prev_post = $post;
$post = get_post($listing_id);
if (is_object($wpseo_front)) {
$wpseo_front->metadesc();
$wpseo_front->metakeywords();
}
$post = $prev_post;
break;
case 'browsecategory':
case 'browsetag':
if ($current_action == 'browsetag') {
$term = get_term_by('slug', get_query_var('tag'), WPBDP_TAGS_TAX);
} else {
$term = get_term_by('slug', get_query_var('category'), WPBDP_CATEGORY_TAX);
if (!$term && get_query_var('category_id')) {
$term = get_term_by('id', get_query_var('category_id'), WPBDP_CATEGORY_TAX);
}
}
if ($term) {
$metadesc = method_exists('WPSEO_Taxonomy_Meta', 'get_term_meta') ? WPSEO_Taxonomy_Meta::get_term_meta($term, $term->taxonomy, 'desc') : wpseo_get_term_meta($term, $term->taxonomy, 'desc');
if (!$metadesc && is_object($wpseo_front) && isset($wpseo_front->options['metadesc-tax-' . $term->taxonomy])) {
$metadesc = wpseo_replace_vars($wpseo_front->options['metadesc-tax-' . $term->taxonomy], (array) $term);
}
if ($metadesc) {
echo '<meta name="description" content="' . esc_attr(strip_tags(stripslashes($metadesc))) . '"/>' . "\n";
}
}
break;
case 'main':
if (is_object($wpseo_front)) {
$wpseo_front->metadesc();
$wpseo_front->metakeywords();
}
break;
default:
break;
}
}
开发者ID:Nedick,项目名称:stzagora-website,代码行数:51,代码来源:business-directory-plugin.php
示例16: localize_term_scraper_script
/**
* Pass variables to js for use with the term-scraper
*
* @return array
*/
public function localize_term_scraper_script()
{
$translations = $this->get_scraper_translations();
$term_id = filter_input(INPUT_GET, 'tag_ID');
$term = get_term_by('id', $term_id, $this->get_taxonomy());
$focuskw = WPSEO_Taxonomy_Meta::get_term_meta($term, $term->taxonomy, 'focuskw');
$taxonomy = get_taxonomy($term->taxonomy);
$options = WPSEO_Options::get_all();
$base_url = home_url('/', null);
if (!$options['stripcategorybase']) {
$base_url = trailingslashit($base_url . $taxonomy->rewrite['slug']);
}
return array('translations' => $translations, 'base_url' => $base_url, 'taxonomy' => $term->taxonomy, 'keyword_usage' => WPSEO_Taxonomy_Meta::get_keyword_usage($focuskw, $term->term_id, $term->taxonomy), 'search_url' => admin_url('edit-tags.php?taxonomy=' . $term->taxonomy . '&seo_kw_filter={keyword}'), 'post_edit_url' => admin_url('edit-tags.php?action=edit&taxonomy=' . $term->taxonomy . '&tag_ID={id}'), 'title_template' => WPSEO_Taxonomy::get_title_template($term), 'metadesc_template' => WPSEO_Taxonomy::get_metadesc_template($term), 'contentTab' => __('Content:', 'wordpress-seo'));
}
开发者ID:healthcommcore,项目名称:osnap,代码行数:19,代码来源:class-taxonomy.php
示例17: update_term
/**
* Update the taxonomy meta data on save.
*
* @param int $term_id ID of the term to save data for.
* @param int $tt_id The taxonomy_term_id for the term.
* @param string $taxonomy The taxonomy the term belongs to.
*/
public function update_term($term_id, $tt_id, $taxonomy)
{
/* Create post array with only our values */
$new_meta_data = array();
foreach (WPSEO_Taxonomy_Meta::$defaults_per_term as $key => $default) {
if ($posted_value = filter_input(INPUT_POST, $key)) {
$new_meta_data[$key] = $posted_value;
}
// If analysis is disabled remove that analysis score value from the DB.
if ($this->is_meta_value_disabled($key)) {
$new_meta_data[$key] = '';
}
}
unset($key, $default);
// Saving the values.
WPSEO_Taxonomy_Meta::set_values($term_id, $taxonomy, $new_meta_data);
}
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:24,代码来源:class-taxonomy.php
示例18: get_focus_keyword
/**
* Returns the focus keyword if this is set, otherwise it will give the term name.
*
* @param stdClass|WP_Term $term The current term.
*
* @return string
*/
private function get_focus_keyword($term)
{
if ($focus_keyword = WPSEO_Taxonomy_Meta::get_term_meta('focuskw', $term->term_id, $term->taxonomy)) {
return $focus_keyword;
}
return $term->name;
}
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:14,代码来源:class-taxonomy-columns.php
示例19: update_term
/**
* Update the taxonomy meta data on save.
*
* @param int $term_id ID of the term to save data for
* @param int $tt_id The taxonomy_term_id for the term.
* @param string $taxonomy The taxonomy the term belongs to.
*/
function update_term($term_id, $tt_id, $taxonomy)
{
$tax_meta = get_option('wpseo_taxonomy_meta');
/* Create post array with only our values */
$new_meta_data = array();
foreach (WPSEO_Taxonomy_Meta::$defaults_per_term as $key => $default) {
if (isset($_POST[$key])) {
$new_meta_data[$key] = $_POST[$key];
}
}
/* Validate the post values */
$old = WPSEO_Taxonomy_Meta::get_term_meta($term_id, $taxonomy);
$clean = WPSEO_Taxonomy_Meta::validate_term_meta_data($new_meta_data, $old);
/* Add/remove the result to/from the original option value */
if ($clean !== array()) {
$tax_meta[$taxonomy][$term_id] = $clean;
} else {
unset($tax_meta[$taxonomy][$term_id]);
if (isset($tax_meta[$taxonomy]) && $tax_meta[$taxonomy] === array()) {
unset($tax_meta[$taxonomy]);
}
}
// Prevent complete array validation
$tax_meta['wpseo_already_validated'] = true;
update_option('wpseo_taxonomy_meta', $tax_meta);
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:33,代码来源:class-taxonomy.php
示例20: __construct
/**
* @param stdClass $term The current term.
*/
public function __construct($term)
{
$this->tax_meta = WPSEO_Taxonomy_Meta::get_term_meta((int) $term->term_id, $term->taxonomy);
}
开发者ID:rtroncoso,项目名称:MamaSabeBien,代码行数:7,代码来源:class-taxonomy-fields-presenter.php
注:本文中的WPSEO_Taxonomy_Meta类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论