• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_tag函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: presscore_search_title_shortcode

 function presscore_search_title_shortcode()
 {
     $title = '';
     $wrap_class = '';
     if (is_search()) {
         $title = get_search_query();
     } else {
         if (is_archive()) {
             if (is_category()) {
                 $title = single_cat_title('', false);
             } elseif (is_tag()) {
                 $title = single_tag_title('', false);
             } elseif (is_author()) {
                 the_post();
                 $title = '<a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta("ID"))) . '" title="' . esc_attr(get_the_author()) . '" rel="me">' . get_the_author() . '</a>';
                 $wrap_class .= ' vcard';
                 rewind_posts();
             } elseif (is_day()) {
                 $title = '<span>' . get_the_date() . '</span>';
             } elseif (is_month()) {
                 $title = '<span>' . get_the_date('F Y');
             } elseif (is_year()) {
                 $title = '<span>' . get_the_date('Y');
             } elseif (is_tax('dt_portfolio_category')) {
                 $title = single_term_title('', false);
             } elseif (is_tax('dt_gallery_category')) {
                 $title = single_term_title('', false);
             }
         }
     }
     if ($title) {
         $title = '<span' . ($wrap_class ? ' class="' . esc_attr($wrap_class) . '"' : '') . '>' . $title . '</span>';
     }
     return $title;
 }
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:35,代码来源:shortcode-search-title.php


示例2: 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


示例3: zfwca_list_categories

/**
 * Display a list categories
 * @param array $args
 * @return bool
 */
function zfwca_list_categories($args = array())
{
    $defaults = array('show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'exclude' => '', 'include' => '', 'exclude_tree' => '', 'current_category' => 0, 'taxonomy' => 'category');
    $r = wp_parse_args($args, $defaults);
    $r['walker'] = new ZFWCA_Post_Category_Walker();
    if (!isset($r['class'])) {
        $r['class'] = 'category' == $r['taxonomy'] ? 'categories' : $r['taxonomy'];
    }
    extract($r);
    if (!taxonomy_exists($taxonomy)) {
        return false;
    }
    $categories = get_categories($r);
    $output = '';
    if (empty($categories)) {
        $output .= 'No categories';
    } else {
        if (empty($r['current_category']) && (is_category() || is_tax() || is_tag())) {
            $current_term_object = get_queried_object();
            if ($current_term_object && $r['taxonomy'] === $current_term_object->taxonomy) {
                $r['current_category'] = get_queried_object_id();
            }
        }
        $output .= walk_category_tree($categories, 0, $r);
    }
    $output = apply_filters('zfwca_wp_list_categories', $output, $args);
    return $output;
}
开发者ID:Juni4567,项目名称:meritscholarship,代码行数:33,代码来源:functions.php


示例4: cpotheme_page_title

 function cpotheme_page_title()
 {
     global $post;
     if (isset($post->ID)) {
         $current_id = $post->ID;
     } else {
         $current_id = false;
     }
     $title_tag = function_exists('is_woocommerce') && is_woocommerce() && is_singular('product') ? 'span' : 'h1';
     echo '<' . $title_tag . ' class="pagetitle-title heading">';
     if (function_exists('is_woocommerce') && is_woocommerce()) {
         woocommerce_page_title();
     } elseif (is_category() || is_tag() || is_tax()) {
         echo single_tag_title('', true);
     } elseif (is_author()) {
         the_author();
     } elseif (is_date()) {
         _e('Archive', 'brilliance');
     } elseif (is_404()) {
         echo __('Page Not Found', 'brilliance');
     } elseif (is_search()) {
         echo __('Search Results for', 'brilliance') . ' "' . get_search_query() . '"';
     } else {
         echo get_the_title($current_id);
     }
     echo '</' . $title_tag . '>';
 }
开发者ID:neetudave,项目名称:heartfulness-uk,代码行数:27,代码来源:markup.php


示例5: widget

 function widget($args, $instance)
 {
     global $wp_query;
     $facets = elasticsearch\Faceting::all();
     $url = null;
     if (is_category() || is_tax()) {
         $url = get_term_link($wp_query->queried_object);
     } elseif (is_tag()) {
         $url = get_tag_link($wp_query->queried_object->term_id);
     } elseif (is_archive()) {
         $url = get_post_type_archive_link($wp_query->queried_object->query_var);
     } elseif (is_search()) {
         $url = home_url('/');
     }
     foreach ($facets as $type => $facet) {
         if (count($facet['selected']) > 0) {
             $name = $type;
             if (taxonomy_exists($type)) {
                 $name = get_taxonomy($type)->label;
             }
             echo '<aside id="facet-' . $type . '-selected" class="widget facets facets-selected">';
             echo '<h3 class="widget-title">' . $name . '</h3>';
             echo '<ul>';
             foreach ($facet['selected'] as $option) {
                 $url = elasticsearch\Faceting::urlRemove($url, $type, $option['slug']);
                 echo '<li id="facet-' . $type . '-' . $option['slug'] . '" class="facet-item">';
                 echo '<a href="' . $url . '">' . $option['name'] . '</a>';
                 echo '</li>';
             }
             echo '</ul>';
             echo '</aside>';
         }
     }
 }
开发者ID:pivotlearning,项目名称:wpsite,代码行数:34,代码来源:widget.php


示例6: sociallyviral_archive_title

 /**
  * Shim for `sociallyviral_archive_title()`.
  *
  * Display the archive title based on the queried object.
  *
  * @todo Remove this function when WordPress 4.3 is released.
  *
  * @param string $before Optional. Content to prepend to the title. Default empty.
  * @param string $after  Optional. Content to append to the title. Default empty.
  */
 function sociallyviral_archive_title($before = '', $after = '')
 {
     if (is_category()) {
         $title = sprintf(__('Category: %s', 'sociallyviral'), single_cat_title('', false));
     } elseif (is_tag()) {
         $title = sprintf(__('Tag: %s', 'sociallyviral'), single_tag_title('', false));
     } elseif (is_author()) {
         $title = sprintf(__('Author: %s', 'sociallyviral'), '<span class="vcard">' . get_the_author() . '</span>');
     } elseif (is_year()) {
         $title = sprintf(__('Year: %s', 'sociallyviral'), get_the_date(_x('Y', 'yearly archives date format', 'sociallyviral')));
     } elseif (is_month()) {
         $title = sprintf(__('Month: %s', 'sociallyviral'), get_the_date(_x('F Y', 'monthly archives date format', 'sociallyviral')));
     } elseif (is_day()) {
         $title = sprintf(__('Day: %s', 'sociallyviral'), get_the_date(_x('F j, Y', 'daily archives date format', 'sociallyviral')));
     } elseif (is_post_type_archive()) {
         $title = sprintf(__('Archives: %s', 'sociallyviral'), post_type_archive_title('', false));
     } elseif (is_tax()) {
         $tax = get_taxonomy(get_queried_object()->taxonomy);
         /* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
         $title = sprintf(__('%1$s: %2$s', 'sociallyviral'), $tax->labels->singular_name, single_term_title('', false));
     } else {
         $title = __('Archives', 'sociallyviral');
     }
     /**
      * Filter the archive title.
      *
      * @param string $title Archive title to be displayed.
      */
     $title = apply_filters('get_the_archive_title', $title);
     if (!empty($title)) {
         echo $before . $title . $after;
     }
 }
开发者ID:bigpopakap,项目名称:clickworthy,代码行数:43,代码来源:template-tags.php


示例7: namespace_add_custom_types

function namespace_add_custom_types($query)
{
    if (is_category() || is_tag() && empty($query->query_vars['suppress_filters'])) {
        $query->set('post_type', array('post', 'nav_menu_item', 'custom_type'));
        return $query;
    }
}
开发者ID:danaiser,项目名称:hollandLawns,代码行数:7,代码来源:custom-post-type.php


示例8: mediamaven_filter_wp_title

/**
 * Title filter 
 */
function mediamaven_filter_wp_title($old_title, $sep, $sep_location)
{
    $site_name = get_bloginfo('name');
    $site_description = get_bloginfo('description');
    // add padding to the sep
    $ssep = ' ' . $sep . ' ';
    if ($site_description && (is_home() || is_front_page())) {
        return $site_name . ' | ' . $site_description;
    } else {
        // find the type of index page this is
        if (is_category()) {
            $insert = $ssep . __('Kategorija', 'media-maven');
        } elseif (is_tag()) {
            $insert = $ssep . __('Žymos', 'media-maven');
        } elseif (is_author()) {
            $insert = $ssep . __('Autorius', 'media-maven');
        } elseif (is_year() || is_month() || is_day()) {
            $insert = $ssep . __('Archyvai', 'media-maven');
        } else {
            $insert = NULL;
        }
        // get the page number we're on (index)
        if (get_query_var('paged')) {
            $num = $ssep . __('Page ', 'media-maven') . get_query_var('paged');
        } elseif (get_query_var('page')) {
            $num = $ssep . __('Page ', 'media-maven') . get_query_var('page');
        } else {
            $num = NULL;
        }
        // concoct and return new title
        return $site_name . $insert . $old_title . $num;
    }
}
开发者ID:doobas,项目名称:kazinopaslaptys,代码行数:36,代码来源:functions.php


示例9: display

 /**
  * Display breadcrumbs
  */
 public function display()
 {
     if (Habakiri::get('is_displaying_bread_crumb') === 'false') {
         return;
     }
     global $wp_query;
     // Set to home
     $home_label = $this->get_home_label();
     $this->set($home_label, home_url('/'));
     // Set to blog
     $post_type = $this->get_post_type();
     if (is_category() || is_tag() || is_date() || is_author() || is_single() && $post_type === 'post') {
         $show_on_front = get_option('show_on_front');
         $page_for_posts = get_option('page_for_posts');
         if ($show_on_front === 'page' && $page_for_posts) {
             $this->set(get_the_title($page_for_posts), get_permalink($page_for_posts));
         }
     }
     // Set current and ancestors
     if (is_404()) {
         $this->set_for_404();
     } elseif (is_search()) {
         $this->set_for_search();
     } elseif (is_tax()) {
         $this->set_for_tax();
     } elseif (is_attachment()) {
         $this->set_for_attachment();
     } elseif (is_page() && !is_front_page()) {
         $this->set_for_page();
     } elseif (is_post_type_archive()) {
         $this->set_for_post_type_archive();
     } elseif (is_single()) {
         $this->set_for_single();
     } elseif (is_category()) {
         $this->set_for_category();
     } elseif (is_tag()) {
         $this->set_for_tag();
     } elseif (is_author()) {
         $this->set_for_author();
     } elseif (is_day()) {
         $this->set_for_day();
     } elseif (is_month()) {
         $this->set_for_month();
     } elseif (is_year()) {
         $this->set_for_year();
     } elseif (is_home() && !is_front_page()) {
         $this->set_for_blog();
     }
     $bread_crumb = array();
     $last_item = array_pop($this->bread_crumb);
     foreach ($this->bread_crumb as $_bread_crumb) {
         if (!empty($_bread_crumb['link'])) {
             $bread_crumb[] = sprintf('<a href="%s">%s</a>', esc_url($_bread_crumb['link']), esc_html($_bread_crumb['title']));
         } else {
             $bread_crumb[] = esc_html($_bread_crumb['title']);
         }
     }
     $bread_crumb[] = sprintf('<strong>%s</strong>', $last_item['title']);
     printf('<div class="breadcrumbs">%s</div>', implode(' &gt; ', apply_filters('habakiri_bread_crumb', $bread_crumb)));
 }
开发者ID:ConductiveIO,项目名称:mbrady,代码行数:63,代码来源:class.breadcrumbs.php


示例10: get_index_headline

function get_index_headline()
{
    if (is_home()) {
        $index_headline = 'Blog Index';
    } else {
        if (is_category()) {
            $category = single_term_title("", false);
            $index_headline = 'Archives for the "' . $category . '" Category';
        } elseif (is_tag()) {
            $tag = single_term_title("", false);
            $index_headline = 'Archives for the "' . $tag . '" Category';
        } elseif (is_day()) {
            $index_headline = 'Archive for ' . get_the_time('F jS, Y');
        } elseif (is_month()) {
            $index_headline = 'Archive for ' . get_the_time('F Y');
        } elseif (is_year()) {
            $index_headline = 'Archive for ' . get_the_time('Y');
        } elseif (is_author()) {
            $index_headline = 'Author Archive';
        } else {
            $index_headline = 'Blog Archives';
        }
    }
    return $index_headline;
}
开发者ID:jordanmaslyn,项目名称:vvv-starter,代码行数:25,代码来源:blog.php


示例11: custom_intro

function custom_intro()
{
    echo "<div class='intro'>";
    if (is_front_page()) {
        if (get_header_image()) {
            echo '<img class="header-image" src="' . esc_url(get_header_image()) . '" alt="' . get_bloginfo('description') . '" />';
        }
    } else {
        // get title
        $id = get_option('page_for_posts');
        if (is_day() || is_month() || is_year() || is_tag() || is_category() || is_singular('post') || is_home()) {
            $the_title = get_the_title($id);
        } else {
            $the_title = get_the_title();
        }
        if (is_home() || is_singular('post')) {
            if (has_post_thumbnail($id)) {
                echo get_the_post_thumbnail($id, 'full');
            } elseif (get_header_image()) {
                echo '<img class="header-image" src="' . esc_url(get_header_image()) . '" alt="' . $the_title . '" />';
            }
        } elseif (has_post_thumbnail() && is_singular('page')) {
            the_post_thumbnail();
        } elseif (get_header_image()) {
            echo '<img class="header-image" src="' . esc_url(get_header_image()) . '" alt="' . $the_title . '" />';
        }
    }
    echo "</div>";
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:29,代码来源:functions.php


示例12: isCptArchive

 /**
  * Test to see if the page is a date based archive page cpt archive
  *
  * @since  1.0.0
  * @access public
  * @param
  * @return boolean
  */
 public function isCptArchive()
 {
     if (is_category() || is_author() || is_tag() || is_date() || is_front_page() || is_home()) {
         return false;
     }
     return true;
 }
开发者ID:Beth3346,项目名称:wordpress-boilerplate,代码行数:15,代码来源:Utility.php


示例13: tcp_add_post_types_in_category_and_tag_template

function tcp_add_post_types_in_category_and_tag_template($query)
{
    if (is_category()) {
        $tcp_add_category = get_option('tcp_add_category');
        $tcp_add_category_array = explode(',', $tcp_add_category);
        $tcp_add_category_array[] = 'post';
        $post_type = get_query_var('post_type');
        if ($post_type) {
            $post_type = $post_type;
        } else {
            $post_type = $tcp_add_category_array;
        }
        $query->set('post_type', $post_type);
        return $query;
    }
    if (is_tag()) {
        $tcp_add_tag = get_option('tcp_add_tag');
        $tcp_add_tag_array = explode(',', $tcp_add_tag);
        $tcp_add_tag_array[] = 'post';
        $post_type = get_query_var('post_type');
        if ($post_type) {
            $post_type = $post_type;
        } else {
            $post_type = $tcp_add_tag_array;
        }
        $query->set('post_type', $post_type);
        return $query;
    }
}
开发者ID:sciserver,项目名称:SciServer-WordPress-Website,代码行数:29,代码来源:add-tags-and-category-to-page.php


示例14: sb_get_layout

/**
 * Gets the layout for the current post, page or taxonomy. If none is specified, use 'layout-default'.
 *
 * @since StartBox 2.5
 * @return string The layout for the given page.
 */
function sb_get_layout()
{
    global $wp_query;
    /* Get the available post layouts and store them in an array */
    foreach (get_theme_support('sb-layouts') as $layout => $key) {
        $layouts[] = $layout;
    }
    /* Set the layout to an empty string. */
    $layout = '';
    /* If viewing a singular post/page, check if a layout has been specified. */
    if (is_singular()) {
        /* Get the current post ID. */
        $post_id = $wp_query->get_queried_object_id();
        /* Get the post layout. */
        $layout = sb_get_post_layout($post_id);
    }
    /* If viewing a taxonomy, check if a layout has been specified */
    if (is_category() || is_tag() || is_tax() || is_archive()) {
        global $wp_query;
        $term = $wp_query->get_queried_object();
        $layout = $term->meta['layout'];
    }
    /* Make sure the given layout is in the array of available post layouts for the theme. */
    if (empty($layout) || !in_array($layout, $layouts) || $layout == 'default') {
        $layout = apply_filters('sb_get_post_layout_default', 'default');
    }
    /* Return the layout and allow plugin/theme developers to override it. */
    return esc_attr(apply_filters('get_theme_layout', "layout-{$layout}"));
}
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:35,代码来源:layouts.php


示例15: security_gate

 /**
  * optimizeMember's Security Gate ( protects WordPress content ).
  *
  * @package optimizeMember\Security
  * @since 3.5
  *
  * @attaches-to ``add_action("wp");``
  *
  * @return null May redirect a browser *(exiting script execution)*, when/if content is NOT available to the current User/Member.
  */
 public static function security_gate()
 {
     do_action("ws_plugin__optimizemember_before_security_gate", get_defined_vars());
     /**/
     if (is_category()) {
         /* Categories & other inclusives. */
         c_ws_plugin__optimizemember_catgs::check_catg_level_access();
     } else {
         if (is_tag()) {
             /* Post/Page Tags & other inclusives. */
             c_ws_plugin__optimizemember_ptags::check_ptag_level_access();
         } else {
             if (is_single()) {
                 /* All Posts & other inclusives. */
                 c_ws_plugin__optimizemember_posts::check_post_level_access();
             } else {
                 if (is_page()) {
                     /* All Pages & other inclusives. */
                     c_ws_plugin__optimizemember_pages::check_page_level_access();
                 } else {
                     /* Else, we simply look at URIs & other inclusives. */
                     c_ws_plugin__optimizemember_ruris::check_ruri_level_access();
                 }
             }
         }
     }
     /**/
     do_action("ws_plugin__optimizemember_after_security_gate", get_defined_vars());
     /**/
     return;
     /* Return for uniformity. */
 }
开发者ID:JalpMi,项目名称:v2contact,代码行数:42,代码来源:security.inc.php


示例16: tarski_doctitle

/**
 * Returns the document title.
 *
 * The order (site name first or last) can be set on the Tarski Options page.
 * While the function ultimately returns a string, please note that filters
 * are applied to an array! This allows plugins to easily alter any aspect
 * of the title. For example, one might write a plugin to change the separator.
 *
 * @since 1.5
 * @deprecated 3.2.0
 *
 * @param string $sep
 * @return string
 *
 * @hook filter tarski_doctitle
 * Filter document titles.
 */
function tarski_doctitle($sep = '&middot;')
{
    _deprecated_function('wp_title', '3.2.0');
    $site_name = get_bloginfo('name');
    $content = trim(wp_title('', false));
    if (is_404()) {
        $content = sprintf(__('Error %s', 'tarski'), '404');
    } elseif (get_option('show_on_front') == 'posts' && is_home()) {
        $content = get_bloginfo('description', 'display');
    } elseif (is_search()) {
        $content = sprintf(__('Search results for %s', 'tarski'), esc_html(get_search_query()));
    } elseif (is_month()) {
        $content = single_month_title(' ', false);
    } elseif (is_tag()) {
        $content = multiple_tag_titles();
    }
    $elements = strlen($content) > 0 ? array('site_name' => $site_name, 'separator' => $sep, 'content' => $content) : array('site_name' => $site_name);
    if (get_tarski_option('swap_title_order')) {
        $elements = array_reverse($elements, true);
    }
    // Filters should return an array
    $elements = apply_filters('tarski_doctitle', $elements);
    // But if they don't, it won't try to implode
    if (is_array($elements)) {
        $doctitle = implode(' ', $elements);
    }
    echo $doctitle;
}
开发者ID:aleksking,项目名称:sherrill,代码行数:45,代码来源:deprecated.php


示例17: semifolio_filter_wp_title

 function semifolio_filter_wp_title($old_title, $sep, $sep_location)
 {
     // add padding to the sep
     $ssep = ' ' . $sep . ' ';
     // find the type of index page this is
     if (is_category()) {
         $insert = $ssep . __('Category', 'slaves');
     } elseif (is_tag()) {
         $insert = $ssep . __('Tag', 'slaves');
     } elseif (is_author()) {
         $insert = $ssep . __('Author', 'slaves');
     } elseif (is_year() || is_month() || is_day()) {
         $insert = $ssep . __('Archives', 'slaves');
     } elseif (is_home()) {
         $insert = $ssep . bloginfo('description');
     } else {
         $insert = NULL;
     }
     // get the page number we're on (index)
     if (get_query_var('paged')) {
         $num = $ssep . __('Page ', 'slaves') . get_query_var('paged');
     } elseif (get_query_var('page')) {
         $num = $ssep . __('Page ', 'slaves') . get_query_var('page');
     } else {
         $num = NULL;
     }
     // concoct and return new title
     return bloginfo('name') . $insert . $old_title . $num;
 }
开发者ID:jokoprastiyo,项目名称:slaves-0.3,代码行数:29,代码来源:extras.php


示例18: wcr_default_category_title

function wcr_default_category_title($headline, $term)
{
    if ((is_category() || is_tag()) && empty($headline)) {
        $headline = $term->name;
    }
    return $headline;
}
开发者ID:andrygorokhovets,项目名称:western,代码行数:7,代码来源:functions.php


示例19: description

function description()
{
    if (is_home() || is_front_page()) {
        echo trim(of_get_option('site_description'));
    } elseif (is_category()) {
        $description = strip_tags(category_description());
        echo trim($description);
    } elseif (is_single()) {
        if (get_the_excerpt()) {
            echo get_the_excerpt();
        } else {
            global $post;
            $description = trim(str_replace(array("\r\n", "\r", "\n", " ", " "), " ", str_replace("\"", "'", strip_tags($post->post_content))));
            echo mb_substr($description, 0, 220, 'utf-8');
        }
    } elseif (is_search()) {
        echo '“';
        the_search_query();
        echo '”为您找到结果 ';
        global $wp_query;
        echo $wp_query->found_posts;
        echo ' 个';
    } elseif (is_tag()) {
        $description = strip_tags(tag_description());
        echo trim($description);
    } else {
        $description = strip_tags(term_description());
        echo trim($description);
    }
}
开发者ID:carpliyz,项目名称:9IPHP,代码行数:30,代码来源:header.php


示例20: check_guide_page

function check_guide_page($type)
{
    if (is_tag()) {
        $tag = get_queried_object();
        $args = array('post_type' => 'guides', 'posts_per_page' => 1, 'name' => $tag->slug);
        $query = new WP_Query($args);
        $has_guide = $query->have_posts();
        if ($has_guide) {
            while ($query->have_posts()) {
                $query->the_post();
                if ($type === 'title') {
                    $title = get_field('guide_meta_title');
                    if ($title) {
                        return $title;
                    }
                }
                if ($type === 'description') {
                    $desc = get_field('guide_meta_description');
                    if ($desc) {
                        return $desc;
                    }
                }
                if ($type === 'image' && has_post_thumbnail()) {
                    $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
                    return $image[0];
                }
            }
        } else {
            if ($type === 'title') {
                $new_title = ucwords($tag->name);
                return $new_title . ' Archives | What The Flicka??';
            }
        }
    }
}
开发者ID:developmentDM2,项目名称:What-The-Flicka,代码行数:35,代码来源:yoast.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_tax函数代码示例发布时间:2022-05-15
下一篇:
PHP is_sys_channel函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap