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; }
/** * 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 } }
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; }
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; } } } }
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; }
/** * 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; }
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; }
/** * 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; }
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; }
/** * 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; }
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 }
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); }
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); }
function build_query($item) { $category = "&category=" . $item['category']['url_name']; $merchant = $item['merchant']['name']; $tag = get_tags($item['tags'], $merchant); return $category . $tag; }
/** * 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 }
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; }
/** * 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(); }
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); }
/** * @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); }
public function tags() { if ($this->filters['post_type']) { return array(); } $tags = (array) get_tags(array('get' => 'all')); return $tags; }
public static function get_tags() { $tags = get_tags(array('hide_empty' => 0, 'number' => 100)); $result = array(); foreach ($tags as $tag) { $result[] = array('value' => $tag->slug, 'label' => $tag->name); } return $result; }
public static function get_tags($options, $force_refresh = false) { global $wpdb; $hash = sha1(serialize($options)); if (!$results) { $results = get_tags($options); } return $results; }
function savetag($item, $key, $wid) { global $tbpref; if (!in_array($item, $_SESSION['TAGS'])) { runsql('insert into ' . $tbpref . 'tags (TgText) values(' . convert_string_to_sqlsyntax($item) . ')', ""); get_tags($refresh = 1); } runsql('insert ignore into ' . $tbpref . 'wordtags (WtWoID, WtTgID) select ' . $wid . ', TgID from ' . $tbpref . 'tags where TgText = ' . convert_string_to_sqlsyntax($item), ""); }
public function tags() { if ($this->filters['post_type']) { return array(); } $tags = (array) get_tags(array('get' => 'all')); $this->check_for_orphaned_terms($tags); return $tags; }
function wp_get_tag_urls() { $tags = get_tags(); $urls = array(); foreach ($tags as $tag) { array_push($urls, get_tag_link($tag->term_id)); } return $urls; }
protected function get_values() { $tags_array = array(); $tags = get_tags(); foreach ($tags as $tag) { $tags_array[$tag->term_id] = array('name' => $tag->name, 'value' => $tag->term_id); } return $tags_array; }
function clear_tag_cache() { global $wpssc; $tagobj = get_tags(); foreach ($tagobj as $tag) { $link = get_tag_link($tag->term_id); $wpssc->delete_cache($link); } }
function vp_get_tags() { $wp_tags = get_tags(array('hide_empty' => 0)); $result = array(); foreach ($wp_tags as $tag) { $result[] = array('value' => $tag->term_id, 'label' => $tag->name); } return $result; }
function pm_ln_get_posts_count_by_tag($tag_name) { $tags = get_tags(array('search' => $tag_name)); foreach ($tags as $tag) { //if ($tag->name == $tag_name) {} return $tag->count; } return 0; }
public static function admin() { parent::admin(); $list = array(); $tags = get_tags(array('hide_empty' => FALSE)); foreach ($tags as $t) { $list[$t->term_id] = $t->name; } self::mkGUI(self::$type, self::$option[self::$name], self::$question, FALSE, self::$except, $list); }