本文整理汇总了PHP中get_term_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP get_term_meta函数的具体用法?PHP get_term_meta怎么用?PHP get_term_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_term_meta函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wp_term_like_callback
function wp_term_like_callback()
{
$id = $_POST['actionId'];
$num = get_term_meta($id, '_term_like', true) ? get_term_meta($id, '_term_like', true) : 0;
$domain = $_SERVER['HTTP_HOST'] != 'localhost' ? $_SERVER['HTTP_HOST'] : false;
// make cookies work with localhost
setcookie('_term_like_' . $id, $id, $expire, '/', $domain, false);
update_term_meta($id, '_term_like', $num + 1);
echo json_encode(array('status' => 200, 'data' => $num + 1));
die;
}
开发者ID:zhboner,项目名称:Modified-Puma,代码行数:11,代码来源:functions.php
示例2: cstmstff_cat_public
function cstmstff_cat_public()
{
$taxonomies = array('cstmstff-cat-public');
$args = array('hide_empty' => 0);
$terms = get_terms($taxonomies, $args);
echo '<h3>' . __('Display Category Public', 'custom-stuff') . '</h3>';
echo '<ul>';
foreach ($terms as $term) {
echo '<li>' . esc_html($term->name) . '</li>';
echo '<li>' . esc_html($term->term_id) . '</li>';
echo '<li>' . esc_html($term->slug) . '</li>';
echo '<li>' . esc_html($term->description) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-text', true)) . '</li>';
echo '<li>' . esc_url(get_term_meta($term->term_id, 'cstmstff-url', true)) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-multitext01', true)) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-multitext02', true)) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-multitext03', true)) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-multitext04', true)) . '</li>';
echo '<li>' . wpautop(esc_textarea(get_term_meta($term->term_id, 'cstmstff-textarea', true))) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-select', true)) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-radio', true)) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-checkbox', true)) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-multicheck01', true)) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-multicheck02', true)) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-multicheck03', true)) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-multicheck04', true)) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-color', true)) . '</li>';
echo '<li>' . esc_url(get_term_meta($term->term_id, 'cstmstff-image', true)) . '</li>';
echo '<li>' . esc_html(get_term_meta($term->term_id, 'cstmstff-editor', true)) . '</li>';
}
echo '</ul>';
echo '<hr />';
}
开发者ID:displaycoffee,项目名称:personal,代码行数:33,代码来源:display-cat-public.php
示例3: genesis_do_taxonomy_title_description
/**
* Add custom headline and / or description to category / tag / taxonomy archive pages.
*
* If the page is not a category, tag or taxonomy term archive, or there's no term, or
* no term meta set, then nothing extra is displayed.
*
* If there's a title to display, it is marked up as a level 1 heading.
*
* If there's a description to display, it runs through `wpautop()` before being added to a div.
*
* @since 1.3.0
*
* @global WP_Query $wp_query Query object.
*
* @return null Return early if not the correct archive page, not page one, or no term meta is set.
*/
function genesis_do_taxonomy_title_description()
{
global $wp_query;
if (!is_category() && !is_tag() && !is_tax()) {
return;
}
$term = is_tax() ? get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')) : $wp_query->get_queried_object();
if (!$term) {
return;
}
$headline = $intro_text = '';
if ($headline = get_term_meta($term->term_id, 'headline', true)) {
$headline = sprintf('<h1 %s>%s</h1>', genesis_attr('archive-title'), strip_tags($headline));
} else {
if (genesis_a11y('headings')) {
$headline = sprintf('<h1 %s>%s</h1>', genesis_attr('archive-title'), strip_tags($term->name));
}
}
if ($intro_text = get_term_meta($term->term_id, 'intro_text', true)) {
$intro_text = apply_filters('genesis_term_intro_text_output', $intro_text);
}
if ($headline || $intro_text) {
printf('<div %s>%s</div>', genesis_attr('taxonomy-archive-description'), $headline . $intro_text);
}
}
开发者ID:tleonard2,项目名称:durablegbFeb,代码行数:41,代码来源:archive.php
示例4: papi_load_taxonomy_type_id
/**
* Load the entry type id on a taxonomy.
*
* @param string $entry_type_id
* @param string $type
*
* @return string
*/
function papi_load_taxonomy_type_id($entry_type_id = '', $type = 'term')
{
if ($type !== 'term') {
return $entry_type_id;
}
$key = papi_get_page_type_key();
$term_id = papi_get_term_id();
$taxonomy = papi_get_taxonomy($term_id);
// Try to load the entry type id from only taxonomy type filter.
if (empty($entry_type_id)) {
$entry_type_id = papi_filter_settings_only_taxonomy_type($taxonomy);
}
// If we have a term id we can load the entry type id from the term.
if (empty($entry_type_id) && $term_id > 0 && papi_supports_term_meta()) {
$meta_value = get_term_meta($term_id, $key, true);
$entry_type_id = empty($meta_value) ? '' : $meta_value;
}
// Load entry type id from the container if it exists.
if (empty($entry_type_id)) {
$key = sprintf('entry_type_id.taxonomy.%s', $taxonomy);
if (papi()->exists($key)) {
return papi()->make($key);
}
}
return $entry_type_id;
}
开发者ID:nlemoine,项目名称:papi,代码行数:34,代码来源:taxonomy.php
示例5: bottom_text_taxonomy_edit_meta_field
function bottom_text_taxonomy_edit_meta_field($term)
{
// put the term ID into a variable
$t_id = $term->term_id;
// retrieve the existing value(s) for this meta field. This returns an array
$term_meta = get_term_meta($t_id, 'cat_meta');
if (!$term_meta) {
$term_meta = add_term_meta($t_id, 'cat_meta', '');
}
?>
<tr class="form-field">
<th scope="row" valign="top"><label for="term_meta[cat_footer]"><?php
_e('Bottom Content', 'flatsome');
?>
</label></th>
<td>
<?php
$content = isset($term_meta[0]['cat_footer']) ? esc_attr($term_meta[0]['cat_footer']) : '';
echo '<textarea id="term_meta[cat_footer]" name="term_meta[cat_footer]">' . $content . '</textarea>';
?>
<p class="description"><?php
_e('Enter a value for this field. Shortcodes are allowed. This will be displayed at bottom of the category.', 'flatsome');
?>
</p>
</td>
</tr>
<?php
}
开发者ID:bqevin,项目名称:wp-shopeasy,代码行数:28,代码来源:wc-admin.php
示例6: tax_detail_map
function tax_detail_map($atts, $template = '', $code = "")
{
global $term_id;
$address = get_term_meta($term_id, 'gaddress', true);
if (trim($address) == '') {
$address = get_term_meta($term_id, 'address', true);
foreach (array('city', 'state', 'zip', 'country') as $field) {
${$field} = get_term_meta($term_id, $field, true);
}
if ($zip != '' || $state != '') {
$address .= ", {$state} {$zip}";
}
if ($country != '') {
$address .= ", {$country}";
}
}
$atts['address'] = $address;
foreach (array('ginfo' => 'info_windows', 'glat' => 'glat', 'glon' => 'glon') as $meta => $att) {
$val = get_term_meta($term_id, $meta, true);
if (!empty($val)) {
$atts[$att] = $val;
}
}
$all_empty = true;
foreach (array('address', 'glat', 'glon') as $field) {
if ('' != trim($atts[$field])) {
$all_empty = false;
break;
}
}
if ($all_empty) {
return '';
}
return $this->google_map($atts, $template, $code);
}
开发者ID:TheMysticalSock,项目名称:westmichigansymphony,代码行数:35,代码来源:venues.php
示例7: edit_category_template_field
function edit_category_template_field($term)
{
$cat_template = get_term_meta($term->term_id, 'wsi_prodcut_cat_template', true);
$templates = array('tempalte1' => 'Template1', 'tempalte2' => 'Template2', 'tempalte3' => 'Template3');
?>
<tr class="form-field">
<th scope="row" valign="top">
<label for="wsi_prodcut_cat_template"><?php
_e('Category template', 'wsigenesis');
?>
</label>
</th>
<td>
<select name="wsi_prodcut_cat_template" id="wsi_prodcut_cat_template">
<?php
foreach ($templates as $val => $label) {
if ($cat_template == $val) {
echo '<option value="' . $val . '" selected>' . $label . '</option>';
} else {
echo '<option value="' . $val . '">' . $label . '</option>';
}
}
?>
</select>
<p class="description"><?php
_e('Select the template which will be applied to all category products', 'wsigenesis');
?>
</p>
</td>
</tr>
<?php
}
开发者ID:swapnilghone,项目名称:WP-codesnippets,代码行数:32,代码来源:addCustomFieldToCustomTaxanomy.php
示例8: get_raw_value
public function get_raw_value()
{
// Since meta data (for posts and users, anyway) was historically loaded by get_*_meta() with $single = false,
// it always returned an array even for single fields. Keeping that for compatibility with toolset-forms and
// simplicity.
return get_term_meta($this->object_id, $this->meta_key, false);
}
开发者ID:phuocdungit,项目名称:fundy,代码行数:7,代码来源:termmeta.php
示例9: delete_term_meta
delete_term_meta($term_id, $ashu_feild['id']);
}
}
}
function save_taxonomy_metadata($term_id)
{
foreach ($this->ashu_feild as $ashu_feild) {
if (isset($ashu_feild['id']) && $ashu_feild['id'] && isset($_POST[$ashu_feild['id']])) {
if (!current_user_can('manage_categories')) {
return;
}
$old_data = get_term_meta($term_id, $ashu_feild['id'], true);
if ($ashu_feild['type'] == 'tinymce') {
$data = stripslashes($_POST[$ashu_feild['id']]);
} elseif ($ashu_feild['type'] == 'checkbox') {
$data = $_POST[$ashu_feild['id']];
} elseif ($ashu_feild['type'] == 'numbers_array' || $ashu_feild['type'] == 'gallery') {
$data = explode(',', $_POST[$ashu_feild['id']]);
$data = array_filter($data);
} elseif (in_array($ashu_feild['type'], array('open', 'close', 'title'))) {
continue;
} else {
$data = htmlspecialchars($_POST[$ashu_feild['id']], ENT_QUOTES, "UTF-8");
}
if ($data == "") {
delete_term_meta($term_id, $ashu_feild['id'], $data);
} else {
update_term_meta($term_id, $ashu_feild['id'], $data);
开发者ID:ashuwp,项目名称:Ashuwp_framework,代码行数:28,代码来源:ashuwp_termmeta_feild.php
示例10: edit_category_seo_field
function edit_category_seo_field($term)
{
global $feature_groups;
?>
<tr class="form-field term-group-wrap">
<th scope="row"><label for="meta-title"><?php
_e('Meta Title', 'jkc');
?>
</label></th>
<td><input name="meta-title" id="meta-title" type="text" value="<?php
echo get_term_meta($term->term_id, 'meta-title', true);
?>
" /><p class="description">This meta title will be used in category listing pages as title tag. </p></td>
</tr><tr class="form-field term-group-wrap">
<th scope="row"><label for="meta-keywords"><?php
_e('Meta Keywords', 'jkc');
?>
</label></th>
<td><textarea name="meta-keywords" rows="3" id="meta-keywords"><?php
echo get_term_meta($term->term_id, 'meta-keywords', true);
?>
</textarea><p class="description">This meta keywords will be used in category listing pages.</p></td>
</tr><tr class="form-field term-group-wrap">
<th scope="row"><label for="meta-keywords"><?php
_e('Meta Description', 'jkc');
?>
</label></th>
<td><textarea name="meta-description" rows="3" id="meta-description"><?php
echo get_term_meta($term->term_id, 'meta-description', true);
?>
</textarea><p class="description">This meta description will be used in category listing pages.</p></td>
</tr><?php
}
开发者ID:srinivas-qfor,项目名称:jkc-wp,代码行数:33,代码来源:admin-category.php
示例11: render_edit_tags
function render_edit_tags($meta)
{
$tab = null;
require_once "taxonomy-metadata.php";
//require_once $this->pluginpath.'options-panel/class.pop_input.php';
foreach ($meta as $i => $o) {
$o->type = property_exists($o, 'type') ? $o->type : 'text';
if (in_array($o->type, array('subtitle'))) {
$method = "__" . $o->type;
$this->{$method}($tab, $i, $o);
continue;
}
if (false !== $this->term_id && $this->term_id > 0) {
$o->load_option = property_exists($o, 'load_option') ? $o->load_option : true;
if ($o->load_option) {
$o->value = get_term_meta($this->term_id, $this->get_meta_key(null, $i, $o), true);
}
}
$output = $this->template;
$output = str_replace("{required}", property_exists($o, 'required') && $o->required ? $this->required_class : '', $output);
$output = str_replace("{class}", $this->get_id(null, $i, $o), $output);
$output = str_replace("{label}", $this->label(null, $i, $o), $output);
$output = str_replace("{input}", $this->input(null, $i, $o), $output);
$output = str_replace("{description}", $this->description(null, $i, $o), $output);
echo $output;
}
}
开发者ID:TheMysticalSock,项目名称:westmichigansymphony,代码行数:27,代码来源:class.custom_taxonomy_with_meta_body.php
示例12: get_image
/**
* Get post image.
*
* @since 1.0.0
* @return string
*/
public function get_image($args = array(), $type = 'post', $ID = 0)
{
$object = call_user_func(array($this, 'get_' . $type . '_object'), $ID);
if ('post' === $type && empty($object->ID) || 'term' === $type && empty($object->term_id)) {
return false;
}
$default_args = array('size' => apply_filters('cherry_normal_image_size', 'post-thumbnail'), 'mobile_size' => apply_filters('cherry_mobile_image_size', 'post-thumbnail'), 'class' => 'wp-image', 'html' => '<img src="%1$s" alt="%2$s" %3$s %4$s >', 'placeholder_background' => '000', 'placeholder_foreground' => 'fff', 'placeholder_title' => '', 'html_tag_suze' => true);
$args = array_merge($default_args, $args);
$size = wp_is_mobile() ? $args['mobile_size'] : $args['size'];
$size_array = $this->get_thumbnail_size_array($size);
$class = $args['class'] ? 'class="' . $args['class'] . '"' : '';
$html_tag_suze = $args['html_tag_suze'] ? 'width="' . $size_array['width'] . 'px" height="' . $size_array['height'] . 'px"' : '';
if ('post' === $type) {
$ID = $object->ID;
$thumbnail_id = get_post_thumbnail_id($ID);
$alt = esc_attr($object->post_title);
} else {
$ID = $object->term_id;
$thumbnail_id = get_term_meta($ID, $this->args['meta_key']['term_thumb'], true);
$alt = esc_attr($object->name);
}
if ($thumbnail_id) {
$src = wp_get_attachment_image_url($thumbnail_id, $size);
} else {
// Place holder defaults attr
$title = $args['placeholder_title'] ? $args['placeholder_title'] : $size_array['width'] . 'x' . $size_array['height'];
$attr = array('width' => $size_array['width'], 'height' => $size_array['height'], 'background' => $args['placeholder_background'], 'foreground' => $args['placeholder_foreground'], 'title' => $title);
$attr = array_map('esc_attr', $attr);
$src = 'http://fakeimg.pl/' . $attr['width'] . 'x' . $attr['height'] . '/' . $attr['background'] . '/' . $attr['foreground'] . '/?text=' . $attr['title'] . '';
}
$html = sprintf($args['html'], $src, $alt, $class, $html_tag_suze);
return $html;
}
开发者ID:vfedushchin,项目名称:KingNews,代码行数:39,代码来源:cherry-media-utilit.php
示例13: category_custom_columns
public static function category_custom_columns($content, $column_name, $term_id)
{
switch ($column_name) {
case "xicolor":
echo "<div class=\"xi_admin_color_box\">\r\n <div class=\"inner\" style=\"background: " . get_term_meta($term_id, 'xi_category_color', true) . "\">\r\n </div>\r\n </div>";
break;
}
}
开发者ID:samoldenburg,项目名称:Xi-Events,代码行数:8,代码来源:xicategorymeta.php
示例14: fsi_term_meta_replace
function fsi_term_meta_replace($term_id, $data)
{
$meta_keys = array_keys(get_term_meta($term_id));
foreach ($meta_keys as $meta_key) {
delete_term_meta($term_id, $meta_key);
}
fsi_term_meta_update($term_id, $data);
}
开发者ID:sourcerer-mike,项目名称:wp-fast-simple-import,代码行数:8,代码来源:term-meta.php
示例15: hocwp_term_get_meta
function hocwp_term_get_meta($term_id, $meta_key, $single = true)
{
$version = hocwp_get_wp_version();
if (version_compare($version, '4.4', '>=')) {
return get_term_meta($term_id, $meta_key, $single);
}
hocwp_term_register_termmeta_table();
return get_metadata('term', $term_id, $meta_key, $single);
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:9,代码来源:term-meta.php
示例16: get_image
/**
* Get post image.
*
* @return string
*/
public function get_image($args = array(), $type = 'post', $id = 0)
{
if (is_callable(array($this, 'get_' . $type . '_object'))) {
$object = call_user_func(array($this, 'get_' . $type . '_object'), $id);
if ('post' === $type && empty($object->ID) || 'term' === $type && empty($object->term_id)) {
return '';
}
}
$default_args = array('visible' => true, 'size' => apply_filters('cherry_normal_image_size', 'post-thumbnail'), 'mobile_size' => apply_filters('cherry_mobile_image_size', 'post-thumbnail'), 'html' => '<a href="%1$s" %2$s ><img src="%3$s" alt="%4$s" %5$s ></a>', 'class' => 'wp-image', 'placeholder' => true, 'placeholder_background' => '000', 'placeholder_foreground' => 'fff', 'placeholder_title' => '', 'html_tag_suze' => true, 'echo' => false);
$args = wp_parse_args($args, $default_args);
$html = '';
if (filter_var($args['visible'], FILTER_VALIDATE_BOOLEAN)) {
$size = wp_is_mobile() ? $args['mobile_size'] : $args['size'];
$size = in_array($size, get_intermediate_image_sizes()) ? $size : 'post-thumbnail';
// Place holder defaults attr
$size_array = $this->get_thumbnail_size_array($size);
switch ($type) {
case 'post':
$id = $object->ID;
$thumbnail_id = get_post_thumbnail_id($id);
$alt = esc_attr($object->post_title);
$link = $this->get_post_permalink();
break;
case 'term':
$id = $object->term_id;
$thumbnail_id = get_term_meta($id, $this->args['meta_key']['term_thumb'], true);
$alt = esc_attr($object->name);
$link = $this->get_term_permalink($id);
break;
case 'attachment':
$thumbnail_id = $id;
$alt = get_the_title($thumbnail_id);
$link = wp_get_attachment_image_url($thumbnail_id, $size);
break;
}
if ($thumbnail_id) {
$image_data = wp_get_attachment_image_src($thumbnail_id, $size);
$src = $image_data[0];
$size_array['width'] = $image_data[1];
$size_array['height'] = $image_data[2];
} elseif (filter_var($args['placeholder'], FILTER_VALIDATE_BOOLEAN)) {
$title = $args['placeholder_title'] ? $args['placeholder_title'] : $size_array['width'] . 'x' . $size_array['height'];
$attr = array('width' => $size_array['width'], 'height' => $size_array['height'], 'background' => $args['placeholder_background'], 'foreground' => $args['placeholder_foreground'], 'title' => $title);
$attr = array_map('esc_attr', $attr);
$width = 4000 < intval($attr['width']) ? 4000 : intval($attr['width']);
$height = 4000 < intval($attr['height']) ? 4000 : intval($attr['height']);
$src = $this->get_placeholder_url(array('width' => $width, 'height' => $height, 'background' => $attr['background'], 'foreground' => $attr['foreground'], 'title' => $attr['title']));
}
$class = $args['class'] ? 'class="' . $args['class'] . '"' : '';
$html_tag_suze = filter_var($args['html_tag_suze'], FILTER_VALIDATE_BOOLEAN) ? 'width="' . $size_array['width'] . '" height="' . $size_array['height'] . '"' : '';
if (isset($src)) {
$html = sprintf($args['html'], $link, $class, $src, $alt, $html_tag_suze);
}
}
return $this->output_method($html, $args['echo']);
}
开发者ID:CherryFramework,项目名称:cherry-framework,代码行数:61,代码来源:cherry-media-utilit.php
示例17: handle_delete_taxonomy_term
function handle_delete_taxonomy_term($term, $tt_id)
{
require_once "taxonomy-metadata.php";
$meta_to_remove = get_term_meta($term, '');
if (is_array($meta_to_remove) && count($meta_to_remove) > 0) {
foreach ($meta_to_remove as $meta_key => $meta) {
delete_term_meta($term, $meta_key);
}
}
}
开发者ID:TheMysticalSock,项目名称:westmichigansymphony,代码行数:10,代码来源:class.custom_taxonomy_with_meta.php
示例18: fifu_cat_column_content
function fifu_cat_column_content($internal_image, $column, $term_id)
{
if ($column == 'featured_image') {
$url = get_term_meta($term_id, 'fifu_image_url', true);
if ($url != '') {
echo sprintf('<img src="%s" width="100"/>', $url);
}
} else {
echo $internal_image;
}
}
开发者ID:BennyHudson,项目名称:eaton,代码行数:11,代码来源:column.php
示例19: edit_category_form_fields
function edit_category_form_fields($term)
{
echo '<tr class="form-field form-required term-order-wrap">';
echo '<th scope="row">' . __('Order', 'asgaros-forum') . '</th>';
echo '<td>';
$order = get_term_meta($term->term_id, 'order', true);
echo '<input type="text" name="category_order" value="' . $order . '" />';
echo '</td>';
echo '</tr>';
do_action('asgarosforum_action_edit_category_form_fields', $term);
}
开发者ID:QuqurUxcho,项目名称:asgaros-forum,代码行数:11,代码来源:admin.php
示例20: import_wp_object
protected function import_wp_object($wp_term_id, $taxonomy)
{
$wp_term = get_term($wp_term_id, $taxonomy);
$this->wp_term = $wp_term;
$this->wp_id = $wp_term_id;
$this->grape_href = get_term_meta($wp_term_id, '_grape_href', true);
$this->grape_indexed = get_term_meta($wp_term_id, '_grape_indexed', true);
$this->wp_type = $taxonomy;
$this->url = '';
$this->title = html_entity_decode(strip_tags(get_the_title($wp_term_id)));
$this->description = term_description($wp_term_id, $taxonomy);
}
开发者ID:ubergrape,项目名称:wordpress,代码行数:12,代码来源:models.php
注:本文中的get_term_meta函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论