本文整理汇总了PHP中get_tags函数的典型用法代码示例。如果您正苦于以下问题:PHP get_tags函数的具体用法?PHP get_tags怎么用?PHP get_tags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_tags函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_name', $instance['title']);
$count = $instance['count'];
$offset = $instance['offset'];
echo $before_widget;
echo $before_title . $title . $after_title;
/**
* <div class="side-hot">
<h2>热门话题</h2>
<div class="hot-qui">
<?php wp_tag_cloud('smallest=12&largest=18&unit=px&number=20&orderby=count&order=DESC');?>
</div>
</div>
*/
echo '<div class="side-hot"><h2>热门话题</h2><div class="hot-qui">';
$tags_list = get_tags('smallest=12&largest=18&unit=px&orderby=count&order=DESC&number=' . $count . '&offset=' . $offset);
if ($tags_list) {
foreach ($tags_list as $tag) {
echo '<a href="' . get_tag_link($tag) . '">' . $tag->name . ' (' . $tag->count . ')</a>';
}
} else {
echo '暂无标签!';
}
echo '</div></div>';
echo $after_widget;
}
开发者ID:wangshijun101,项目名称:morketing.cn,代码行数:28,代码来源:tags.php
示例2: render_content
/**
* Function to render the content on the theme customizer page
*
* @access public
* @since 1.0.0
*
* @param null
* @return void
*
*/
public function render_content()
{
$coder_tags = get_tags();
if (!empty($coder_tags)) {
?>
<label>
<span class="customize-control-title"><?php
echo esc_html($this->label);
?>
</span>
<select <?php
$this->link();
?>
>
<?php
$coder_default_value = $this->value();
if (-1 == $coder_default_value || empty($coder_default_value)) {
$coder_default_selected = 1;
} else {
$coder_default_selected = 0;
}
printf('<option value="-1" %s>%s</option>', selected($coder_default_selected, 1, false), __('Select', 'coder-customizer-framework'));
foreach ($coder_tags as $coder_post) {
printf('<option value="%s" %s>%s</option>', $coder_tags->term_id, selected($this->value(), $coder_post->ID, false), $coder_tags->name);
}
?>
</select>
</label>
<?php
}
}
开发者ID:kafleg,项目名称:coder-customizer-framework,代码行数:41,代码来源:coder-tags-dropdown-control.php
示例3: getPost
function getPost()
{
$data = new stdClass();
$categoryId = (int) get_query_var('cat');
if (is_tag()) {
$data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
$tagQuery = get_query_var('tag');
$tagData = get_tags(array('slug' => $tagQuery));
$data->post->post_title = esc_html($tagData[0]->name);
} elseif (is_category($categoryId)) {
$category = get_category($categoryId);
$data->post = get_post(ThemeOption::getOption('blog_category_post_id'));
$data->post->post_title = ThemeHelper::esc_html($category->name);
} elseif (is_day()) {
$data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
$data->post->post_title = get_the_date();
} elseif (is_archive()) {
$data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
$data->post->post_title = single_month_title(' ', false);
} elseif (is_search()) {
$data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
$data->post->post_title = sprintf(__('Search result for phrase <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
} elseif (is_404()) {
$data->post = get_post(ThemeOption::getOption('page_404_page_id'));
$data->post->post_title = $data->post->post_title;
} else {
return false;
}
return $data;
}
开发者ID:annguyenit,项目名称:HawaiiEducation,代码行数:30,代码来源:Theme.Post.class.php
示例4: wp_aatags_alts
function wp_aatags_alts($post_ID, $post_title, $post_content)
{
$tags = get_tags(array('hide_empty' => false));
$tagx = get_option('wp_aatags_opts');
$number = get_option('wp_aatags_aadnumber');
switch ($tagx) {
case 3:
$d = strtolower($post_title . ' ' . wp_trim_words($post_content, 333, ''));
break;
case 2:
$d = strtolower($post_title . ' ' . wp_trim_words($post_content, 999, ''));
break;
default:
$d = strtolower($post_title);
break;
}
if ($tags) {
$i = 0;
foreach ($tags as $tag) {
if (strpos($d, strtolower($tag->name)) !== false) {
wp_set_post_tags($post_ID, $tag->name, true);
$i++;
}
if ($i == $number) {
break;
}
}
}
}
开发者ID:yszar,项目名称:linuxwp,代码行数:29,代码来源:wp-autotags.php
示例5: get_filterby_terms
function get_filterby_terms()
{
$filtertype = $_POST['filtertype'];
$terms = array();
switch ($filtertype) {
case 'category':
$cats = get_categories();
foreach ($cats as $cat) {
$terms[$cat->term_id] = $cat->name;
}
break;
case 'tag':
$tags = get_tags();
foreach ($tags as $tag) {
$terms[$tag->slug] = $tag->name;
}
break;
case 'post_type':
$terms = $this->project_organizer->available_post_types();
break;
}
$terms = apply_filters('anth_get_posts_by', $terms, $filtertype);
print json_encode($terms);
die;
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:25,代码来源:class-ajax-handlers.php
示例6: seo_tag_cloud
/**
* Display tag cloud.
*
* The text size is set by the 'smallest' and 'largest' arguments, which will
* use the 'unit' argument value for the CSS text size unit. The 'format'
* argument can be 'flat' (default), 'list', 'nolink', or 'array'. The flat value for the
* 'format' argument will separate tags with spaces. The list value for the
* 'format' argument will format the tags in a UL HTML list. The nolink value for the
* 'format' argument will display the tags without links. The array value for the
* 'format' argument will return in PHP array type format.
*
* The 'orderby' argument will accept 'name' or 'count' and defaults to 'name'.
* The 'order' is the direction to sort, defaults to 'ASC' and can be 'DESC'.
*
* The 'number' argument is how many tags to return. By default, the limit will
* be to return the top 20 tags in the tag cloud list.
*
* The 'topic_count_text_callback' argument is a function, which, given the count
* of the posts with that tag, returns a text for the tooltip of the tag link.
* @see default_topic_count_text
*
* The 'exclude' and 'include' arguments are used for the {@link get_tags()}
* function. Only one should be used, because only one will be used and the
* other ignored, if they are both set.
*
* @since 2.3.0
*
* @param array|string $args Optional. Override default arguments.
* @return array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument.
*/
function seo_tag_cloud($args = '')
{
$defaults = array('largest' => 10, 'number' => 20, 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '', 'link' => 'view', 'target' => '');
$args = wp_parse_args($args, $defaults);
$tags = get_tags(array_merge($args, array('orderby' => 'count', 'order' => 'DESC')));
// Always query top tags
if (empty($tags)) {
return;
}
foreach ($tags as $key => $tag) {
if ('edit' == $args['link']) {
$link = get_edit_tag_link($tag->term_id);
} else {
$link = get_tag_link($tag->term_id);
}
if (is_wp_error($link)) {
return false;
}
$tags[$key]->link = $link;
$tags[$key]->id = $tag->term_id;
}
$return = seo_tag_cloud_generate($tags, $args);
// Here's where those top tags get sorted according to $args
$return = apply_filters('wp_tag_cloud', $return, $args);
if ('array' == $args['format']) {
return $return;
}
echo $return;
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:59,代码来源:seo-tag-cloud.php
示例7: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_name', $instance['title']);
$count = $instance['count'];
$offset = $instance['offset'];
$more = $instance['more'];
$link = $instance['link'];
$mo = '';
if ($more != '' && $link != '') {
$mo = '<a class="btn" href="' . $link . '">' . $more . '</a>';
}
echo $before_widget;
echo $before_title . $mo . $title . $after_title;
echo '<div class="d_tags">';
$tags_list = get_tags('orderby=count&order=DESC&number=' . $count . '&offset=' . $offset);
if ($tags_list) {
foreach ($tags_list as $tag) {
echo '<a title="' . $tag->count . '个话题" href="' . get_tag_link($tag) . '">' . $tag->name . ' (' . $tag->count . ')</a>';
}
} else {
echo '暂无标签!';
}
echo '</div>';
echo $after_widget;
}
开发者ID:dfc643,项目名称:ARCHIVE-2014-wordpress-theme-backup,代码行数:26,代码来源:wid-tags.php
示例8: optionsframework_options
/**
* Defines an array of options that will be used to generate the settings page and be saved in the database.
* When creating the 'id' fields, make sure to use all lowercase and no spaces.
*
* If you are making your theme translatable, you should replace 'options_framework_theme'
* with the actual text domain for your theme. Read more:
* http://codex.wordpress.org/Function_Reference/load_theme_textdomain
*/
function optionsframework_options()
{
// Pull all the categories into an array
$options_categories = array();
$options_categories_obj = get_categories();
foreach ($options_categories_obj as $category) {
$options_categories[$category->cat_ID] = $category->cat_name;
}
// Pull all tags into an array
$options_tags = array();
$options_tags_obj = get_tags();
foreach ($options_tags_obj as $tag) {
$options_tags[$tag->term_id] = $tag->name;
}
// Pull all the pages into an array
$options_pages = array();
$options_pages_obj = get_pages('sort_column=post_parent,menu_order');
$options_pages[''] = 'Select a page:';
foreach ($options_pages_obj as $page) {
$options_pages[$page->ID] = $page->post_title;
}
// If using image radio buttons, define a directory path
$imagepath = get_template_directory_uri() . 'assets/img/images/';
$options = array();
// Include All Options
include_once 'library/watertower_admin/social-media.php';
// Social Media Options
include_once 'library/watertower_admin/programs.php';
// Programs Options
include_once 'library/watertower_admin/footer.php';
// Footer Options
include_once 'library/watertower_admin/acceptance-packets.php';
// Acceptance Packets Options
return $options;
}
开发者ID:josh-rathke,项目名称:WaterTower,代码行数:43,代码来源:options.php
示例9: get_social_tags
function get_social_tags($id)
{
$follower_array = array();
$follow_array = get_follows($id);
$merged_array = array();
$tags = array();
foreach (get_follows($id) as $follow) {
$fame = get_tags($follow);
if (0 < count($fame)) {
foreach (get_followers($follow) as $follower) {
$follower_array[] = $follower;
}
foreach ($follow_array as $element1) {
foreach ($follower_array as $element2) {
if ($element1 == $element2) {
$merged_array[] = $element1;
}
}
}
if (tag_shade_filter(count($merged_array), count($follow_array))) {
foreach ($fame as $added_tag) {
$tags[] = $added_tag;
}
}
}
}
$tags = array_unique($tags);
return $tags;
}
开发者ID:pggm,项目名称:generalwill20,代码行数:29,代码来源:t_get_social_tags.php
示例10: widget
/**
* Outputs the HTML for this widget.
*
* @param array An array of standard parameters for widgets in this theme
* @param array An array of settings for this widget instance
* @return void Echoes it's output
**/
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
$text = empty($instance['text']) ? ' ' : apply_filters('widget_title', $instance['text']);
echo $before_widget;
echo $before_title;
echo $title;
// Can set this with a widget option, or omit altogether
echo $after_title;
//
// Widget display logic goes here
//
/*oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo*/
/* Here We Go, BUild the Gate to prevent headache to find out which the Output*/
/*oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo*/
?>
<?php
$tags = get_tags();
$html = '<div class="tags">';
foreach ($tags as $tag) {
$tag_link = get_tag_link($tag->term_id);
$html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>#";
$html .= "{$tag->name}</a>";
}
$html .= '</div>';
echo $html;
?>
<?php
echo $after_widget;
}
开发者ID:webtechfreaky,项目名称:vienna-content-focused-personal-blog-theme,代码行数:39,代码来源:tags.php
示例11: formatAttribute
function formatAttribute()
{
global $post;
?>
<ul class="post-in">
<li>
<?php
esc_html_e("Posted In : ", "charity");
the_category(" , ");
$tags = get_tags();
if (!empty($tags)) {
the_tags(" , ");
}
?>
</li>
<li>
<a href="<?php
comments_link();
?>
"><?php
comments_number('0 : comment', '1 : comment', '% : comments');
?>
</a>
</li>
</ul>
<?php
}
开发者ID:Angelpm28,项目名称:ong-canada,代码行数:27,代码来源:post-format-hooks.php
示例12: My_TagCloud
function My_TagCloud($params = array())
{
extract(shortcode_atts(array('orderby' => 'name', 'order' => 'ASC', 'number' => '', 'wrapper' => '', 'sizeclass' => 'tagSize-', 'sizemin' => 1, 'sizemax' => 5), $params));
// initialize
$ret = '';
$min = 9999999;
$max = 0;
// fetch all WordPress tags
$tags = get_tags(array('orderby' => $orderby, 'order' => $order, 'number' => $number));
// get minimum and maximum number tag counts
foreach ($tags as $tag) {
$min = min($min, $tag->count);
$max = max($max, $tag->count);
}
// generate tag list
foreach ($tags as $tag) {
$url = get_tag_link($tag->term_id);
if ($max > $min) {
$class = $sizeclass . floor(($tag->count - $min) / ($max - $min) * ($sizemax - $sizemin) + $sizemin);
} else {
$class = $sizeclass;
}
$ret .= ($wrapper ? '<' . $wrapper . ' class="tagWrapper">' : '') . '<a href="' . $url . '" class="' . $class . ' link">' . $tag->name . '</a>' . ($wrapper ? '</' . $wrapper . '>' : '');
}
return str_replace(get_bloginfo('url'), '', $ret);
}
开发者ID:synergia,项目名称:mknm-synergia-theme,代码行数:26,代码来源:utils.php
示例13: in_widget_form
public function in_widget_form($widget, $return, $instance)
{
$widvis_conditions = array('action' => '', 'rules' => array('main' => array(), 'page' => array(), 'cat' => array(), 'author' => array(), 'tag' => array(), 'archive' => array()));
if (isset($instance['widvis_conditions'])) {
$instance['widvis_conditions']['rules'] = wp_parse_args($instance['widvis_conditions']['rules'], $widvis_conditions['rules']);
// Apply defaults so keys are not missing and prevent notice
} else {
$instance['widvis_conditions'] = $widvis_conditions;
}
$categories = get_categories(array('number' => 1000, 'orderby' => 'count', 'order' => 'DESC'));
$authors = get_users(array('orderby' => 'display_name'));
$tags = get_tags();
$pages = get_pages();
$vars = array();
$vars['widget'] = $widget;
$vars['categories'] = $categories;
$vars['authors'] = $authors;
$vars['tags'] = $tags;
$vars['pages'] = $pages;
$vars['instance'] = $instance;
$vars['widvis'] = $this;
$vars['pages_list'] = $this->pages_list;
$vars['categories_list'] = $this->categories_list;
$vars['textdomain'] = $this->plugin['textdomain'];
$this->plugin['view']->render('widget-admin.php', $vars);
}
开发者ID:luisfbmelo,项目名称:saudacorwebsite,代码行数:26,代码来源:Admin.php
示例14: build_query
function build_query($item)
{
$category = "&category=" . $item['category']['url_name'];
$merchant = $item['merchant']['name'];
$tag = get_tags($item['tags'], $merchant);
return $category . $tag;
}
开发者ID:jack-bonser,项目名称:argos-coding-test,代码行数:7,代码来源:argos_api.php
示例15: render_content
/**
* Render the content on the theme customizer page
*/
public function render_content()
{
?>
<label>
<span class="customize-tags-dropdown"><?php
echo esc_html($this->label);
?>
</span>
<select name="<?php
echo $this->id;
?>
" id="<?php
echo $this->id;
?>
">
<?php
$args = wp_parse_args($this->args, array());
$tags = get_tags($args);
foreach ($tags as $tag) {
echo '<option value="' . $tag->term_id . '" ' . selected($this->value, $tag->term_id) . '>' . $tag->name . '</option>';
}
?>
</select>
</label>
<?php
}
开发者ID:style55,项目名称:WordPress-Theme-Customizer-Custom-Controls,代码行数:29,代码来源:tags_dropdown_custom_control.php
示例16: widget
function widget($args, $instance)
{
extract($args);
$current_taxonomy = $this->_get_current_taxonomy($instance);
if (!empty($instance['title'])) {
$title = $instance['title'];
} else {
if ('post_tag' == $current_taxonomy) {
$title = __('Tags', 'tfuse');
} else {
$tax = get_taxonomy($current_taxonomy);
$title = $tax->labels->name;
}
}
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
$b = $instance['b'] = empty($instance['b']) ? '' : $instance['b'];
$class = $b ? 'widget-boxed' : '';
$before_widget = '<div class="widget widget_tag_cloud ' . $class . '">';
$after_widget = '</div>';
$before_title = '<h3 class="widget-title">';
$after_title = '</h3>';
echo $before_widget;
$title = tfuse_qtranslate($title);
if ($title) {
}
?>
<?php
echo $before_title . $title . $after_title;
echo '<div class="tagcloud clearfix">';
if ($instance['taxonomy'] != 'category') {
$posttags = get_tags();
if ($posttags) {
$count = 0;
foreach ($posttags as $tag) {
$count++;
if ($count == count($posttags)) {
echo '<a href="' . get_tag_link($tag->term_id) . '">' . $tag->name . '</a>';
} else {
echo '<a href="' . get_tag_link($tag->term_id) . '">' . $tag->name . ' </a>';
}
}
}
} else {
$posttags = get_categories();
if ($posttags) {
$count = 0;
foreach ($posttags as $tag) {
$count++;
if ($count == count($posttags)) {
echo '<a href="' . get_category_link($tag->term_id) . '">' . $tag->name . '</a>';
} else {
echo '<a href="' . get_category_link($tag->term_id) . '">' . $tag->name . ' </a>';
}
}
}
}
echo "</div>\n";
echo $after_widget;
}
开发者ID:pinchpointer,项目名称:ppsitewordpress,代码行数:59,代码来源:TFuse_Widget_Tag_Cloud.php
示例17: get_all_tag_ids
/**
* Retrieves a unique array of all Tag IDs in the database.
*
* @package s2Member\Utilities
* @since 3.5
*
* @return array Unique array of all Tag IDs *(as integers)*.
*/
public static function get_all_tag_ids()
{
foreach ((array) get_tags("hide_empty=0") as $tag) {
$tag_ids[] = (int) $tag->term_id;
}
// Collect Tag's ID.
return !empty($tag_ids) && is_array($tag_ids) ? array_unique($tag_ids) : array();
}
开发者ID:donwea,项目名称:nhap.org,代码行数:16,代码来源:utils-gets.inc.php
示例18: e_tags
public function e_tags(WP_REST_Request $request)
{
$id = $request->get_param("id");
if (empty($id)) {
return get_tags();
}
return wp_get_post_tags($id);
}
开发者ID:judahnator,项目名称:WP-API-Categories-Tags,代码行数:8,代码来源:endpoints.class.php
示例19: get_asset_tags
/**
* @param $conn
* @param $asset_id
*
* @return array
*/
function get_asset_tags($conn, $asset_id)
{
if (!Asset_host::is_allowed($conn, $asset_id)) {
$error = _('Asset Not Allowed');
Util::response_bad_request($error);
}
return get_tags($conn, $asset_id);
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:14,代码来源:get_asset_tags.php
示例20: tags
public function tags()
{
if ($this->filters['post_type']) {
return array();
}
$tags = (array) get_tags(array('get' => 'all'));
return $tags;
}
开发者ID:mikevanwinkle,项目名称:cli,代码行数:8,代码来源:class-wp-export-query.php
注:本文中的get_tags函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论