本文整理汇总了PHP中get_tax_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP get_tax_meta函数的具体用法?PHP get_tax_meta怎么用?PHP get_tax_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_tax_meta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_category_meta
function get_category_meta($post_id = NULL, $cat_id = NULL)
{
// Return array
$final = array();
// All category IDs
$categories = wp_get_post_categories($post_id);
if (isset($categories[0]) || !is_null($cat_id)) {
$has_category = true;
// Get the TERM for the category
if (isset($categories[0])) {
$term = get_term_by('id', $categories[0], "category");
$final['cat_id'] = $categories[0];
} else {
$term = get_term_by('id', $cat_id, "category");
$final['cat_id'] = $cat_id;
}
// Get all meta data for the Category
$getTaxMeta = get_tax_meta($term);
// Grab the Category COLOR
$cat_color = $getTaxMeta['wish_dish_color'];
// Append a # to the beginning of the color if it doesn't have one
if (strpos($cat_color, "#") === false) {
$cat_color = "#" . $cat_color;
}
$final['cat_meta'] = $getTaxMeta;
$final['cat_color'] = $cat_color;
$final['cat_bg_image'] = isset($getTaxMeta['wish_dish_image'][0]) ? wp_get_attachment_url($getTaxMeta['wish_dish_image'][0]) : NULL;
return $final;
} else {
return false;
}
}
示例2: add_price_column_content
function add_price_column_content($value, $column_name, $id)
{
$price = get_tax_meta($id, 'print_variation_price');
$priceFormatted = number_format($price, 2, '.', '');
$symbol = get_woocommerce_currency_symbol();
return $symbol . $priceFormatted;
}
示例3: product_cat_column
public function product_cat_column($columns, $column, $id)
{
if ($column == 'icon') {
$icon = get_tax_meta($id, 'st_icon');
$columns .= '<i style="font-size:24px" class="' . TravelHelper::handle_icon($icon) . '"></i>';
}
return $columns;
}
示例4: kdesc_title_tag_rewtite
function kdesc_title_tag_rewtite($title)
{
if (is_category() || is_tag()) {
$tax_id = is_category() ? get_query_var('cat') : get_query_var('tag_id');
$title = get_tax_meta($tax_id, 'm_kdesc_title') ? get_tax_meta($tax_id, 'm_kdesc_title') . ' | ' . get_bloginfo('name') : $title;
}
return $title;
}
示例5: add_to_context
function add_to_context($data)
{
/* this is where you can add your own data to Timber's context object */
$categories = get_categories(array('orderby' => 'id'));
foreach ($categories as $k => $val) {
$categories[$k]->tipo_projeto = get_tax_meta($val->term_id, 'cda_radio_field_id');
if (get_tax_meta($val->term_id, 'cda_radio_field_id') == 'conceito') {
$categories[$k]->tipo_projeto_label = 'Projeto Conceito';
} else {
$categories[$k]->tipo_projeto_label = 'Projeto Piloto';
}
$categories[$k]->imagem_representativa = get_tax_meta($val->term_id, 'cda_image_field_id');
$categories[$k]->imagem_representativa['src'] = wp_get_attachment_url($categories[$k]->imagem_representativa['id']);
$categories[$k]->cor_representativa = get_tax_meta($val->term_id, 'cda_color_field_id');
}
$data['categories'] = $categories;
$data['is_user_logged_in'] = is_user_logged_in();
$data['current_user'] = wp_get_current_user();
$data['is_admin'] = is_admin();
$data['redirect_to'] = 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
$data['menu'] = new TimberMenu();
return $data;
}
示例6: dt_geodir_insert_taxonomy
function dt_geodir_insert_taxonomy($post_type, $catname, $folder_name, $last_catid)
{
$uploads = wp_upload_dir();
// Array of key => value pairs
$dummy_image_url = get_template_directory_uri() . "/assets/images";
$uploaded = (array) fetch_remote_file("{$dummy_image_url}/cat_icon.png");
$new_path = null;
$new_url = null;
if (empty($uploaded['error'])) {
$new_path = $uploaded['file'];
$new_url = $uploaded['url'];
}
$wp_filetype = wp_check_filetype(basename($new_path), null);
$attachment = array('guid' => $uploads['baseurl'] . '/' . basename($new_path), 'post_mime_type' => $wp_filetype['type'], 'post_title' => preg_replace('/\\.[^.]+$/', '', basename($new_path)), 'post_content' => '', 'post_status' => 'inherit');
$attach_id = wp_insert_attachment($attachment, $new_path);
// you must first include the image.php file
// for the function wp_generate_attachment_metadata() to work
require_once ABSPATH . 'wp-admin/includes/image.php';
$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
wp_update_attachment_metadata($attach_id, $attach_data);
if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), $post_type);
}
}
示例7: get_all_category_ids
<?php
$category_ids = get_all_category_ids();
if ($category_ids) {
$cat_css = ' <style> ';
$cat_js = ' <script> ';
foreach ($category_ids as $cat_id) {
$cat_color = get_tax_meta($cat_id, 'pego_category_color');
if ($cat_color != '') {
$cat_css .= ' .main-menu .sf-menu > li.menu-cat-item-' . $cat_id . ' > a { border-top: 5px solid ' . $cat_color . '; } ';
$cat_css .= ' .main-menu .sf-menu > li.menu-cat-item-' . $cat_id . ' > a:hover, .main-menu .sf-menu > li.menu-cat-item-' . $cat_id . ' > a:focus, .main-menu .sf-menu > li.menu-cat-item-' . $cat_id . '.sfHover > a,
.main-menu .sf-menu > li.menu-cat-item-' . $cat_id . '.sfHover .submenu_1
{ background-color: ' . $cat_color . '; color: #fff; } ';
$cat_css .= ' .main-menu ul.sf-menu li.menu-cat-item-' . $cat_id . '.current-menu-item > a,
.main-menu ul.sf-menu > li.menu-cat-item-' . $cat_id . '.current-menu-parent > a,
.main-menu ul.sf-menu.cat-color-' . $cat_id . ' > li.menu-cat-item-' . $cat_id . '.current-menu-ancestor > a,
.main-menu .sf-menu > li.menu-cat-item-' . $cat_id . ' > a:focus
{ background-color: ' . $cat_color . '; } ';
//$cat_css .= ' .main-menu .sf-menu > li.menu-cat-item-'.$cat_id.'.sfHover > a { background-color: #fff; color: #000; } ';
$cat_css .= ' .category-' . $cat_id . ' .main-menu .sf-menu { border-color: ' . $cat_color . '; } ';
$cat_css .= ' .category-' . $cat_id . ' .vc_progress_bar .vc_single_bar.bar_blue .vc_bar { background-color: ' . $cat_color . '; } ';
$cat_css .= ' .category-' . $cat_id . ' .review-average { background-color: ' . $cat_color . '; } ';
$cat_css .= ' .main-menu ul.sf-menu.cat-color-' . $cat_id . ' { border-color: ' . $cat_color . '; } ';
$cat_css .= ' .category-color-' . $cat_id . ' { color: ' . $cat_color . '; } ';
$cat_css .= ' .category-bg-color-' . $cat_id . ' { background-color: ' . $cat_color . ' !important; } ';
$cat_css .= ' .category-hover-color-' . $cat_id . ':hover { color: ' . $cat_color . ' !important; } ';
$cat_js .= ' jQuery(document).ready(function(){
jQuery(".main-menu .sf-menu > li.menu-cat-item-' . $cat_id . ' > a, .main-menu .sf-menu > li.menu-cat-item-' . $cat_id . ' > .submenu_1").hover(function(){
jQuery(".main-menu .sf-menu").addClass("cat-color-' . $cat_id . '");
},function(){
示例8: array
*
* @package WordPress
* @subpackage Timber
* @since Timber 0.1
*/
$context = Timber::get_context();
$query = array('orderby' => 'meta_value_num', 'order' => 'asc', 'posts_per_page' => 12, 'post_type' => 'avaliacao', 'meta_query' => array(array('key' => 'ordem')));
$context['posts'] = Timber::get_posts($query);
$category_slug = get_query_var('category_name');
$obj_category = get_category_by_slug($category_slug);
$context['step_avaliacao'] = 'step_selected';
$context['show_step_2'] = true;
$context['nome_projeto'] = $obj_category->name;
$context['id_projeto'] = $obj_category->term_id;
$context['slug_projeto'] = $obj_category->slug;
$context['cor_projeto'] = get_tax_meta($obj_category->term_id, 'cda_color_field_id');
$context['username'] = get_query_var('username');
if (get_query_var('username')) {
$current_user = get_user_by('login', get_query_var('username'));
$context['profile'] = $current_user;
$context['compartilhar_imagem'] = get_stylesheet_directory_uri() . '/assets/images/avaliacao_share_facebook_geral.jpg';
} else {
global $current_user;
get_currentuserinfo();
$context['profile'] = $current_user;
$context['compartilhar_link'] = get_bloginfo('home') . '/projetos/' . $category_slug . '/' . $current_user->user_login;
}
if ($_GET['answered'] == 1) {
$context['mensagem'] = 'Você já deu sua opnião sobre esse projeto. Nevegue pelos outros para contribuir mais.';
}
$time = current_time('mysql');
示例9: foreach
$term_icon = '';
if (!empty($post->post_category)) {
foreach ($post->post_category as $post_taxonomy => $post_term) {
if ($post_term != '' && !is_array($post_term)) {
$post_term = explode(',', trim($post_term, ','));
}
$post_term = array_unique($post_term);
if (!empty($post_term)) {
foreach ($post_term as $cat_id) {
$cat_id = trim($cat_id);
if ($cat_id != '') {
/*if($term_icon_url = get_tax_meta($cat_id,'ct_cat_icon'))
$term_icon = $term_icon_url['src'];*/
$term_icon = get_option('geodir_default_marker_icon');
if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') {
$term_icon = $term_icon_url['src'];
}
break;
}
}
}
}
}
}
}
$post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
$post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
$srcharr = array("'", "/", "-", '"', '\\');
$replarr = array("′", "⁄", "–", "“", '');
示例10: get_stylesheet_directory
include get_stylesheet_directory() . "/css/layout.php";
wp_head();
// Include custom header stuff if there is any (haven't thoroughly tested this escaping)
if ($wipHeadMeta) {
$allowedHeaderTags = array('link' => array('href' => array(), 'rel' => array(), 'type' => array(), 'media' => array()), 'style' => array('type' => array(), 'media' => array()), 'script' => array('type' => array(), 'src' => array()));
echo wp_kses($wipHeadMeta, $allowedHeaderTags);
}
// If navigation override is in place
$categories = get_the_category();
foreach ($categories as $category) {
$categoryID = $category->cat_ID;
if (get_tax_meta($categoryID, 'navOverride')) {
echo '<script language="JavaScript" type="text/javascript">var navcurrentpage="' . get_tax_meta($categoryID, 'navOverride') . '";</script>';
}
if ((is_category($categoryID) || in_category($categoryID)) && get_tax_meta($categoryID, 'customCSS')) {
echo '<link rel="stylesheet" href="' . get_tax_meta($categoryID, 'customCSS') . '" type="text/css" media="all" />';
}
}
?>
<script type="text/javascript"> Shadowbox.init(); </script>
</head>
<body<?php
if ($wipBodyMeta) {
echo ' ' . esc_attr($wipBodyMeta);
}
/* Include custom body attribute stuff if there is any*/
?>
>
<?php
if (!defined('CAHNRSANALYTICS')) {
示例11: get_terms
<div class="form-group">
<label for="title">Τίτλος</label>
<input type="text" class="form-control" id="title" name="title" placeholder="Τίτλος της Ιδέας">
</div>
<div class="form-group">
<label for="ideacat">Κύκλος Υποβολής</label>
<?php
if ($call != 0) {
echo '<input type="text" class="form-control" id="idea_cat" name="idea_cat_dummy" value="' . $call_name . '" disabled="disabled" />';
echo '<input type="hidden" id="title" name="idea_cat" value="' . $call . '" />';
} else {
echo '<select name="idea_cat" id="idea_cat" class="form-control" tabindex="4"> ';
$catz = get_terms('idea_cat', array('hide_empty' => false));
foreach ($catz as $cat) {
$is_active = get_tax_meta($cat->term_id, 'opengov_is_active');
if ($is_active) {
$selected = '';
if ($call != 0 and $cat->term_id == $call) {
$selected = 'selected="selected"';
}
echo '<option class="level-0" value="' . $cat->term_id . '" ' . $selected . '>' . $cat->name . '</option>';
}
}
echo '</select>';
}
?>
</div>
<div class="form-group">
示例12: geodir_add_meta_keywords
//.........这里部分代码省略.........
$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
} elseif ($location_type == 'region') {
$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
} elseif ($location_type == 'country') {
$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
$replace_location = __($replace_location, 'geodirectory');
}
$country = get_query_var('gd_country');
$region = get_query_var('gd_region');
$city = get_query_var('gd_city');
$current_location = '';
if ($country != '') {
$current_location = get_actual_location_name('country', $country, true);
}
if ($region != '') {
$current_location = get_actual_location_name('region', $region);
}
if ($city != '') {
$current_location = get_actual_location_name('city', $city);
}
$replace_location = $current_location != '' ? $current_location : $replace_location;
}
$geodir_meta_keys = '';
$geodir_meta_desc = '';
if ($is_geodir_page && !empty($geodir_post_type_info)) {
if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
$geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
$geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
if ($geodir_is_category) {
$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : NULL;
if (isset($category->term_id) && !empty($category->term_id)) {
$category_id = $category->term_id;
$category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
if ($location_id) {
$option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
$cat_loc_option = get_option($option_name);
$gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
if (!$gd_cat_loc_default) {
$option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
$option = get_option($option_name);
$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
}
}
$geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
}
} else {
if ($geodir_is_tag) {
$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
}
}
}
}
$gd_page = '';
if (geodir_is_page('home')) {
$gd_page = 'home';
$meta_desc = get_option('geodir_meta_desc_homepage') ? get_option('geodir_meta_desc_homepage') : $meta_desc;
} elseif (geodir_is_page('detail')) {
$gd_page = 'detail';
$meta_desc = get_option('geodir_meta_desc_detail') ? get_option('geodir_meta_desc_detail') : $meta_desc;
} elseif (geodir_is_page('pt')) {
$gd_page = 'pt';
$meta_desc = get_option('geodir_meta_desc_pt') ? get_option('geodir_meta_desc_pt') : $meta_desc;
} elseif (geodir_is_page('listing')) {
$gd_page = 'listing';
$meta_desc = get_option('geodir_meta_desc_listing') ? get_option('geodir_meta_desc_listing') : $meta_desc;
示例13: get_term_by
<div class="sideitem grey">
<?php
//Get the correct taxonomy ID by slug
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
//Get Taxonomy Meta
$saved_data = get_tax_meta($term->term_id, 'ba_text_field_id');
?>
<div class="commonname">
<b>Common Name:</b>
<?php
if (!empty($saved_data)) {
echo $saved_data;
} else {
the_title();
}
?>
</div><!-- common name -->
<div class="taxonomy-item">
<div class="all-classifications">
<div class="thelionking">
<h2>Classification</h2>
<div class="class-row">
<div class="left-classif">Kingdom: </div>
<div class="right-classif" id="kingdom"><?php
echo get_the_term_list($post->ID, 'kingdomtag');
?>
示例14: esc_attr
echo esc_attr($font_size);
?>
>
<ul class="booking-item-features booking-item-features-expand mb30 clearfix">
<?php
foreach ($terms as $key2 => $value2) {
?>
<li class="<?php
if ($item_col) {
echo 'col-sm-' . $item_col;
}
?>
">
<?php
if (function_exists('get_tax_meta') and $icon = get_tax_meta($value2->term_id, 'st_icon')) {
?>
<i class="<?php
echo TravelHelper::handle_icon($icon);
?>
"></i>
<?php
}
?>
<span class="booking-item-feature-title"><?php
echo esc_html($value2->name);
?>
</span>
</li>
<?php
}
示例15: get_terms
<?php
$terms = get_terms('cases', array('hide_empty' => false));
?>
<section class="case-links">
<div class="inner">
<?php
$i = 0;
foreach ($terms as $term) {
$i++;
if ($i < 3) {
?>
<?php
$term_img = get_tax_meta($term->term_id, 'case_type_img', true);
?>
<a href="<?php
echo get_term_link($term->term_id, 'cases');
?>
" class="case-link loading" data-bg="<?php
echo $term_img['url'];
?>
">
<h3 class="case-link-title"><?php
echo $term->name;
?>
</h3>
</a>
<?php
}
}
?>