当前位置: 首页>>代码示例>>PHP>>正文


PHP is_page_have_tags函数代码示例

本文整理汇总了PHP中is_page_have_tags函数的典型用法代码示例。如果您正苦于以下问题:PHP is_page_have_tags函数的具体用法?PHP is_page_have_tags怎么用?PHP is_page_have_tags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_page_have_tags函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: admin_menu

 /**
  * Register metabox for suggest tags, for post, and optionnaly page.
  *
  * @return void
  * @author Amaury Balmer
  */
 public static function admin_menu()
 {
     add_meta_box('suggestedtags', __('Suggested tags', 'simpletags'), array(__CLASS__, 'metabox'), 'post', 'advanced', 'core');
     if (is_page_have_tags()) {
         add_meta_box('suggestedtags', __('Suggested tags', 'simpletags'), array(__CLASS__, 'metabox'), 'page', 'advanced', 'core');
     }
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:13,代码来源:class.admin.suggest.php

示例2: helperClickTags

 /**
  * Register metabox
  *
  * @return void
  * @author Amaury Balmer
  */
 function helperClickTags()
 {
     add_meta_box('st-clicks-tags', __('Click tags', 'simpletags'), array(&$this, 'boxClickTags'), 'post', 'advanced', 'core');
     if (is_page_have_tags()) {
         add_meta_box('st-clicks-tags', __('Click tags', 'simpletags'), array(&$this, 'boxClickTags'), 'page', 'advanced', 'core');
     }
 }
开发者ID:rubyerme,项目名称:rubyerme.github.com,代码行数:13,代码来源:class.admin.clickterms.php

示例3: helperSuggestTags

 /**
  * Register metabox for suggest tags, for post, and optionnaly page.
  *
  * @return void
  * @author Amaury Balmer
  */
 function helperSuggestTags()
 {
     add_meta_box('suggestedtags', __('Suggested tags', 'simpletags'), array(&$this, 'boxSuggestTags'), 'post', 'advanced', 'core');
     if (is_page_have_tags()) {
         add_meta_box('suggestedtags', __('Suggested tags', 'simpletags'), array(&$this, 'boxSuggestTags'), 'page', 'advanced', 'core');
     }
 }
开发者ID:rubyerme,项目名称:rubyerme.github.com,代码行数:13,代码来源:class.admin.suggest.php

示例4: SimpleTags_Admin_Suggest

 function SimpleTags_Admin_Suggest()
 {
     global $pagenow;
     // Ajax action, JS Helper and admin action
     add_action('wp_ajax_' . 'simpletags', array(&$this, 'ajaxCheck'));
     // Box for post
     add_action('admin_menu', array(&$this, 'helperSuggestTags_Post'), 1);
     // Box for Page
     if (is_page_have_tags()) {
         add_action('admin_menu', array(&$this, 'helperSuggestTags_Page'), 1);
     }
     wp_register_script('st-helper-suggested-tags', STAGS_URL . '/inc/js/helper-suggested-tags.min.js', array('jquery', 'st-helper-add-tags'), STAGS_VERSION);
     wp_localize_script('st-helper-suggested-tags', 'stHelperSuggestedTagsL10n', array('title_bloc' => $this->getSuggestTagsTitle(), 'content_bloc' => __('Choose a provider to get suggested tags (local, yahoo or tag the net).', 'simpletags')));
     // Register location
     $wp_post_pages = array('post.php', 'post-new.php');
     $wp_page_pages = array('page.php', 'page-new.php');
     // Helper for posts/pages
     if (in_array($pagenow, $wp_post_pages) || in_array($pagenow, $wp_page_pages) && is_page_have_tags()) {
         wp_enqueue_script('st-helper-suggested-tags');
     }
 }
开发者ID:howardlei82,项目名称:IGSM-Website,代码行数:21,代码来源:class.admin.suggest.php

示例5: getTerms


//.........这里部分代码省略.........
     }
     if (!empty($exclude)) {
         $exterms = wp_parse_id_list($exclude);
         foreach ($exterms as $exterm) {
             if (empty($exclusions)) {
                 $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
             } else {
                 $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
             }
         }
     }
     if (!empty($exclusions)) {
         $exclusions .= ')';
     }
     $exclusions = apply_filters('list_terms_exclusions', $exclusions, $args);
     $where .= $exclusions;
     // ST Features : Restrict category
     if ($category != 0) {
         if (!is_array($taxonomies)) {
             $taxonomies = array($taxonomies);
         }
         $incategories = wp_parse_id_list($category);
         $taxonomies = "'" . implode("', '", $taxonomies) . "'";
         $incategories = "'" . implode("', '", $incategories) . "'";
         $where .= " AND tr.object_id IN ( ";
         $where .= "SELECT tr.object_id FROM {$wpdb->term_relationships} AS tr INNER JOIN {$wpdb->term_taxonomy} AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id INNER JOIN {$wpdb->posts} as p ON tr.object_id=p.ID WHERE tt.term_id IN ({$incategories}) AND p.post_status='publish'";
         $where .= " ) ";
         $join_relation = true;
         unset($incategories, $category);
     }
     // ST Features : Limit posts date
     if ($limit_days != 0) {
         $where .= " AND tr.object_id IN ( ";
         $where .= "SELECT DISTINCT ID FROM {$wpdb->posts} AS p WHERE p.post_status='publish' AND " . (is_page_have_tags() ? "p.post_type IN('page', 'post')" : "post_type = 'post'") . " AND p.post_date_gmt > '" . date('Y-m-d H:i:s', time() - $limit_days * 86400) . "'";
         $where .= " ) ";
         $join_relation = true;
         unset($limit_days);
     }
     if (!empty($slug)) {
         $slug = sanitize_title($slug);
         $where .= " AND t.slug = '{$slug}'";
     }
     if (!empty($name__like)) {
         $where .= " AND t.name LIKE '{$name__like}%'";
     }
     if ('' !== $parent) {
         $parent = (int) $parent;
         $where .= " AND tt.parent = '{$parent}'";
     }
     // ST Features : Another way to search
     if (strpos($st_name__like, ' ') !== false) {
         $st_terms_formatted = array();
         $st_terms = preg_split('/[\\s,]+/', $st_name_like);
         foreach ((array) $st_terms as $st_term) {
             if (empty($st_term)) {
                 continue;
             }
             $st_terms_formatted[] = "t.name LIKE '%" . like_escape($st_term) . "%'";
         }
         $where .= " AND ( " . explode(' OR ', $st_terms_formatted) . " ) ";
         unset($st_term, $st_terms_formatted, $st_terms);
     } elseif (!empty($st_name__like)) {
         $where .= " AND t.name LIKE '%{$st_name__like}%'";
     }
     // ST Features : Add min usage
     if ($hide_empty && !$hierarchical) {
开发者ID:rongandat,项目名称:best-picture,代码行数:67,代码来源:class.client.tagcloud.php

示例6: add_meta_boxes

 /**
  * Call meta box public static function for taxonomy tags for each CPT
  *
  * @param string $post_type 
  * @return boolean
  * @author Amaury Balmer
  */
 public static function add_meta_boxes($post_type)
 {
     $taxonomies = get_object_taxonomies($post_type);
     if (in_array('post_tag', $taxonomies)) {
         if ($post_type == 'page' && !is_page_have_tags()) {
             return false;
         }
         remove_meta_box('post_tag' . 'div', $post_type, 'side');
         remove_meta_box('tagsdiv-' . 'post_tag', $post_type, 'side');
         add_meta_box('adv-tagsdiv', __('Tags (Simple Tags)', 'simpletags'), array(__CLASS__, 'metabox'), $post_type, 'side', 'core', array('taxonomy' => 'post_tag'));
         return true;
     }
     return false;
 }
开发者ID:rongandat,项目名称:best-picture,代码行数:21,代码来源:class.admin.autocomplete.php

示例7: addMatchTerms

 /**
  * Method for add terms for all or specified posts
  *
  * @param string $taxonomy
  * @param string $match
  * @param string $new
  * @return boolean
  * @author Amaury Balmer
  */
 function addMatchTerms($taxonomy = 'post_tag', $match, $new)
 {
     if (trim(str_replace(',', '', stripslashes($new))) == '') {
         $this->message = __('No new term(s) specified!', 'simpletags');
         $this->status = 'error';
         return false;
     }
     $match_terms = explode(',', $match);
     $new_terms = explode(',', $new);
     $match_terms = array_filter($match_terms, '_delete_empty_element');
     $new_terms = array_filter($new_terms, '_delete_empty_element');
     $counter = 0;
     if (!empty($match_terms)) {
         // Match and add
         // Get terms ID from old match names
         $terms_id = array();
         foreach ((array) $match_terms as $match_term) {
             $term = get_term_by('name', $match_term, $taxonomy);
             $terms_id[] = (int) $term->term_id;
         }
         // Get object ID with terms ID
         $objects_id = get_objects_in_term($terms_id, $taxonomy, array('fields' => 'all_with_object_id'));
         // Add new tags for specified post
         foreach ((array) $objects_id as $object_id) {
             wp_set_object_terms($object_id, $new_terms, $taxonomy, true);
             // Append terms
             $counter++;
         }
         // Clean cache
         clean_object_term_cache($objects_id, $taxonomy);
         clean_term_cache($terms_id, $taxonomy);
     } else {
         // Add for all posts
         // Page or not ?
         $post_type_sql = is_page_have_tags() ? "post_type IN('page', 'post')" : "post_type = 'post'";
         // TODO, CPT
         // Get all posts ID
         global $wpdb;
         $objects_id = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE {$post_type_sql}");
         // Add new tags for all posts
         foreach ((array) $objects_id as $object_id) {
             wp_set_object_terms($object_id, $new_terms, $taxonomy, true);
             // Append terms
             $counter++;
         }
         // Clean cache
         clean_object_term_cache($objects_id, $taxonomy);
     }
     if ($counter == 0) {
         $this->message = __('No term added.', 'simpletags');
     } else {
         $this->message = sprintf(__('Term(s) added to %1s post(s).', 'simpletags'), $counter);
     }
     return true;
 }
开发者ID:rubyerme,项目名称:rubyerme.github.com,代码行数:64,代码来源:class.admin.manage.php

示例8: registerMetaBox

 /**
  * Call meta box function for taxonomy tags for each CPT
  *
  * @param string $post_type 
  * @return boolean
  * @author Amaury Balmer
  */
 function registerMetaBox($post_type)
 {
     $taxonomies = get_object_taxonomies($post_type);
     if (in_array('post_tag', $taxonomies)) {
         if ($post_type == 'page' && !is_page_have_tags()) {
             return false;
         }
         remove_meta_box('post_tag' . 'div', $post_type, 'side');
         remove_meta_box('tagsdiv-' . 'post_tag', $post_type, 'side');
         add_meta_box('adv-tagsdiv', __('Tags (Simple Tags)', 'simpletags'), array(&$this, 'boxTags'), $post_type, 'side', 'core', array('taxonomy' => 'post_tag'));
         return true;
     }
     return false;
 }
开发者ID:rubyerme,项目名称:rubyerme.github.com,代码行数:21,代码来源:class.admin.autocomplete.php

示例9: admin_enqueue_scripts

 /**
  * Init somes JS and CSS need for simple tags.
  *
  * @return void
  * @author Amaury Balmer
  */
 public static function admin_enqueue_scripts()
 {
     global $pagenow;
     // Helper simple tags
     wp_register_script('st-helper-add-tags', STAGS_URL . '/assets/js/helper-add-tags.js', array('jquery'), STAGS_VERSION);
     wp_register_script('st-helper-options', STAGS_URL . '/assets/js/helper-options.js', array('jquery'), STAGS_VERSION);
     // Register CSS
     wp_register_style('st-admin', STAGS_URL . '/assets/css/admin.css', array(), STAGS_VERSION, 'all');
     // Register location
     $wp_post_pages = array('post.php', 'post-new.php');
     $wp_page_pages = array('page.php', 'page-new.php');
     // Common Helper for Post, Page and Plugin Page
     if (in_array($pagenow, $wp_post_pages) || in_array($pagenow, $wp_page_pages) && is_page_have_tags() || isset($_GET['page']) && in_array($_GET['page'], array('st_mass_terms', 'st_auto', 'st_options', 'st_manage'))) {
         wp_enqueue_style('st-admin');
     }
     // add jQuery tabs for options page. Use jQuery UI Tabs from WP
     if (isset($_GET['page']) && $_GET['page'] == 'st_options') {
         wp_enqueue_script('jquery-ui-tabs');
         wp_enqueue_script('st-helper-options');
     }
 }
开发者ID:liangwei1988,项目名称:wordpress,代码行数:27,代码来源:class.admin.php


注:本文中的is_page_have_tags函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。