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


PHP term_description函数代码示例

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


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

示例1: illdy_archive_description

 function illdy_archive_description($before = '', $after = '')
 {
     $description = apply_filters('get_the_archive_description', term_description());
     if (!empty($description)) {
         echo $before . $description . $after;
     }
 }
开发者ID:robertoperata,项目名称:bbqverona.com,代码行数:7,代码来源:template-tags.php

示例2: meta_description

 /**
  * add meta_description
  *
  * hook after post has loaded to add a unique meta-description
  *
  */
 public static function meta_description()
 {
     $post = new \TimberPost();
     // check for custom field
     $description = wptexturize($post->get_field('meta_description'));
     if (is_tax()) {
         if ($temp = term_description(get_queried_object(), get_query_var('taxonomy'))) {
             $description = $temp;
         }
     } elseif (is_post_type_archive()) {
         if ($temp = get_the_archive_description()) {
             $description = $temp;
         }
     }
     // else use preview
     if (empty($description)) {
         $description = str_replace('', "'", $post->get_preview(40, true, false, true));
     }
     // finally use the blog description
     if (empty($description)) {
         $description = get_bloginfo('description', 'raw');
     }
     $description = esc_attr(wp_strip_all_tags($description));
     // limit to SEO recommended length
     if (strlen($description) > 155) {
         $description = substr($description, 0, 155);
         $description = \TimberHelper::trim_words($description, str_word_count($description) - 1);
     }
     return $description;
 }
开发者ID:benedict-w,项目名称:pressgang,代码行数:36,代码来源:site.php

示例3: wpex_post_subheading

 function wpex_post_subheading()
 {
     // Vars
     global $post;
     $output = '';
     // Posts & Pages
     if (is_singular()) {
         $post_id = $post->ID;
         $subheading = get_post_meta($post_id, 'wpex_post_subheading', true);
         $output = '';
         if ($subheading) {
             $output .= '<div class="clr page-subheading">';
             $output .= do_shortcode($subheading);
             $output .= '</div>';
         }
     }
     // Archives
     if (is_tax()) {
         $obj = get_queried_object();
         $taxonomy = $obj->taxonomy;
         $term_id = $obj->term_id;
         $description = term_description($term_id, $taxonomy);
         if (!empty($description)) {
             $output .= '<div class="clr page-subheading term-description">';
             $output .= $description;
             $output .= '</div>';
         }
     }
     // Return content
     return $output;
 }
开发者ID:nhatnam1102,项目名称:wp-content,代码行数:31,代码来源:page-header.php

示例4: store_seo_info

function store_seo_info()
{
    if (get_post_type() == 'store' && !is_singular()) {
        $id = get_queried_object_id();
        if ((taxonomy_exists('products_category') || taxonomy_exists('products_tag')) && $id != 0) {
            $term_name = get_term_field('name', $id, 'products_category');
            $title = $term_name;
            $paged = get_query_var('paged');
            if ($paged > 1) {
                $title .= sprintf(__(' - 第 %s 页 ', 'tinection'), $paged);
            }
            $title .= ' - ' . get_bloginfo('name') . '商城';
            $keywords = $term_name . ",商城";
            $description = strip_tags(term_description());
        } elseif (is_archive() && $id == 0) {
            $title = ot_get_option('shop_archives_title', 'WordPress商店');
            $paged = get_query_var('paged');
            if ($paged > 1) {
                $title .= sprintf(__(' - 第 %s 页 ', 'tinection'), $paged);
            }
            $title .= ' - ' . get_bloginfo('name');
            $keywords = '商品归档,商城,归档';
            $description = get_bloginfo('name') . '商城';
        }
        $seo_text = '<title>' . $title . '</title><meta name="description" content="' . $description . '" /><meta name="keywords" content="' . $keywords . '" />';
    } else {
        $seo_text = '';
    }
    return $seo_text;
}
开发者ID:xiapistudio,项目名称:tinection-fixed,代码行数:30,代码来源:shop.php

示例5: register_meta_tags

 public function register_meta_tags()
 {
     add_action('wp_head', function () {
         if (is_singular() && false == post_password_required()) {
             if ('' == ($description = get_the_excerpt())) {
                 $description = wp_trim_words(esc_html(strip_shortcodes(get_the_content())), 20, '...');
             }
         } elseif (is_category() && '' != category_description()) {
             $description = category_description();
         } elseif (is_tag() && '' != term_description()) {
             $description = term_description();
         } else {
             $description = get_bloginfo('description');
         }
         $description = esc_attr($description);
         echo "<meta name=\"description\" content=\"{$description}\" />\n";
         echo "<meta name=\"og:description\" content=\"{$description}\" />\n";
         if (is_singular() && false == post_password_required() && has_post_thumbnail()) {
             list($image, $width, $height) = wp_get_attachment_image_src(get_post_thumbnail_id(), 'facebook');
         } else {
             $image = apply_filters('', $this->get_theme_assets_url() . '/images/logo-fb.png');
         }
         $image = esc_url($image);
         echo "<meta name=\"og:image\" content=\"{$image}\" />\n";
         echo "<meta name=\"twitter:image\" content=\"{$image}\" />\n";
     });
 }
开发者ID:shtrihstr,项目名称:wpk15-theme-wpkit,代码行数:27,代码来源:Initialization.php

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

示例7: ubik_seo_meta_description

function ubik_seo_meta_description($desc = '')
{
    // Generate a meta description
    if (empty($desc)) {
        // Single posts, pages, and attachments
        if (is_singular()) {
            $post = get_post();
            if (empty($post)) {
                $desc = '';
            }
            $desc = wptexturize($post->post_content);
            // Get the entire contents, not the excerpt, so as to not duplicate Ubik Excerpt
        }
        // Check to see if we have a description for this category, tag, or taxonomy
        if (is_category() || is_tag() || is_tax()) {
            $desc = term_description();
        }
        // Now match other possibilities...
        if (is_author()) {
            $desc = get_the_author_meta('description');
        }
        // Front or home page
        if (is_front_page() || is_home()) {
            $desc = get_bloginfo('description');
        }
        // No excerpt to return
        if (is_404() || is_search()) {
            $desc = '';
        }
        $desc = ubik_seo_meta_description_sanitize($desc);
    }
    return apply_filters('ubik_seo_meta_description', $desc);
}
开发者ID:synapticism,项目名称:ubik-seo,代码行数:33,代码来源:ubik-seo-meta-description.php

示例8: woocommerce_category_archive_description

function woocommerce_category_archive_description()
{
    if (is_tax(array('product_cat', 'product_tag')) && get_query_var('paged') == 0) {
        $description = wc_format_content(term_description());
        $image = false;
        if (is_tax() || is_tag() || is_category()) {
            $term = get_queried_object();
            $thumbnail_id = absint(get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true));
            if ($thumbnail_id) {
                $image = wp_get_attachment_image($thumbnail_id, 250);
            } else {
                $image = wc_placeholder_img_src();
            }
        }
        if ($description) {
            $string = '<div class="row margin-bottom">';
            if ($image) {
                $string .= '<div class="col-sm-4 col-sm-push-8">' . $image . '</div>';
            }
            $string .= '<div class="term-description col-sm-8';
            if ($image) {
                $string .= ' col-sm-pull-4';
            }
            $string .= '">' . $description . '</div></div>';
            echo $string;
        }
    }
}
开发者ID:n3ssi3,项目名称:tauch-terminal,代码行数:28,代码来源:functions_woocommerce.php

示例9: pods_tutorials_list

function pods_tutorials_list($ids, $heading, $dashicon)
{
    //include only terms whose ids were set in $ids param
    $args = array('include' => $ids);
    //get the terms matching the args
    $terms = get_terms('tutorial_type', $args);
    //add underscores to $heading in separate var for ul id
    $name = str_replace(' ', '-', $heading);
    echo '<h3>' . $heading . '</h3>';
    echo '<ul id="tutorials-' . $name . '" class="tutorials-topics-list">';
    //loop through terms
    foreach ($terms as $term) {
        //get link, description and name for each term.
        $link = get_term_link($term);
        $description = term_description($term->term_id, 'tutorial_type');
        $name = $term->name;
        //create list item
        echo '<li><div class="dashicons ' . $dashicon . ' tutorial-term-dashicon"></div><div class="tutorial-term"><a href="' . $link . '">' . $name . '</a>';
        if (!empty($description)) {
            echo '<br /><span class="tutorial-term-description">' . strip_tags($description, '') . '</span>';
        }
        echo '</div></li>';
    }
    //endforeach
    echo '</ul>';
}
开发者ID:logoscreative,项目名称:pods-code-library,代码行数:26,代码来源:list-taxonomy-terms.php

示例10: calibrefx_meta_description

/**
 * Output description
 *
 * @return string $description
 */
function calibrefx_meta_description()
{
    global $post, $wp_query, $wp_locale;
    $desc = '';
    if (is_home() || is_front_page()) {
        $desc = get_bloginfo('description');
    } elseif (is_singular()) {
        $desc = calibrefx_truncate_phrase($post->post_content, calibrefx_get_option('content_archive_limit'));
    } elseif (is_archive()) {
        if (is_category()) {
            $desc = category_description(get_query_var('cat'));
        } elseif (is_tax()) {
            $term = $wp_query->get_queried_object();
            $desc = term_description($term->term_id, $term->taxonomy);
        } elseif (is_year()) {
            $desc = __('All posts in ', 'calibrefx') . get_query_var('year');
        } elseif (is_month()) {
            $desc = __('All Posts in ', 'calibrefx') . $wp_locale->get_month(get_query_var('monthnum')) . ' ' . get_query_var('year');
        } elseif (is_day()) {
            $desc = __('All Posts in ', 'calibrefx') . get_query_var('day') . ' ' . $wp_locale->get_month(get_query_var('monthnum')) . ' ' . get_query_var('year');
        } elseif (is_author()) {
            $desc = get_user_meta($wp_query->queried_object->ID, 'intro_text', true);
        } elseif (is_post_type_archive()) {
            $post_type = $wp_query->get_queried_object();
            $desc = $post_type->description;
        }
    } elseif (is_404()) {
        $desc = __('Page not found ', 'calibrefx');
    }
    $desc = str_replace(array('<p>', '</p>'), array('', ''), $desc);
    $desc = htmlentities($desc);
    return apply_filters('calibrefx_meta_description', $desc);
}
开发者ID:alispx,项目名称:calibrefx,代码行数:38,代码来源:meta-helper.php

示例11: et_brand_description

 function et_brand_description()
 {
     if (is_tax('brand') && term_description() != '') {
         echo '<div class="term-description">';
         echo term_description();
         echo '</div>';
     }
 }
开发者ID:baridavid,项目名称:themes,代码行数:8,代码来源:woo.php

示例12: header_data

 /**
  * Header data for header section
  *
  * @return array
  */
 public static function header_data()
 {
     $header_image = get_header_image();
     $page_layout_class = ' .page-layout-' . Model_Page_Layout_Settings::get_layout() . ' .page-layout-width-' . Model_Page_Layout_Settings::get_width() . ' .page-layout-sidebar-width-' . Model_Page_Layout_Settings::get_sidebar_width();
     $header = array('allowedtags' => $GLOBALS['allowedtags'], 'language_attributes' => get_language_attributes(), 'body_class' => implode(' ', get_body_class()) . $page_layout_class, 'charset' => get_bloginfo('charset'), 'ping_back_url' => get_bloginfo('pingback_url'), 'name' => get_bloginfo('name'), 'home_url' => esc_url(home_url('/')), 'description' => get_bloginfo('description'), 'favicon' => General_Site_Settings_Model::get_favicon(), 'touch_icon' => General_Site_Settings_Model::get_touch_icon(), 'custom_styles' => '', 'is_enabled_preloader' => Model_Logo_And_Favicon::is_enable_page_preloader(), 'logo' => General_Site_Settings_Model::get_logo(), 'socials' => View::make('blocks/socials', array('socials' => Social_Settings_Model::get_all_socials(), 'where' => 'header')), 'socials_show_header' => Social_Settings_Model::is_show_header(), 'disclimer' => Header_Settings_Model::get_disclimer(), 'search_box' => Header_Settings_Model::get_search_box(), 'header_style_layout' => Header_Settings_Model::get_header_style(), 'header_layout_view' => sprintf('header-%s', Header_Settings_Model::get_header_style()), 'header_image' => $header_image, 'header_slogan' => get_option('photolab_header_slogan'), 'header_class' => Header_Settings_Model::get_header_class(), 'static_class' => empty($header_image) ? 'static' : 'absolute', 'term_description' => term_description(), 'welcome_message' => get_option('photolab'), 'main_menu' => wp_nav_menu(array('theme_location' => 'main', 'container' => 'nav', 'container_class' => 'main-navigation', 'container_id' => 'site-navigation', 'menu_class' => 'sf-menu', 'walker' => new Photolab_Walker(), 'echo' => false)), 'top_menu' => wp_nav_menu(array('theme_location' => 'top', 'container' => 'nav', 'container_class' => 'top-navigation', 'container_id' => 'site-navigation', 'menu_class' => 'sf-top-menu', 'walker' => new Photolab_Walker(), 'echo' => false)));
     $header['alt_mess'] = Utils::array_get($header['welcome_message'], 'welcome_title', get_bloginfo('name'));
     return $header;
 }
开发者ID:gcofficial,项目名称:basetheme,代码行数:13,代码来源:main.php

示例13: sportspress_taxonomy_archive_description

 /**
  * Show an archive description on taxonomy archives
  *
  * @access public
  * @subpackage	Archives
  * @return void
  */
 function sportspress_taxonomy_archive_description()
 {
     if (is_tax(array('sp_season', 'sp_league', 'sp_venue', 'sp_position')) && get_query_var('paged') == 0) {
         $description = apply_filters('the_content', term_description());
         if ($description) {
             echo '<div class="term-description">' . $description . '</div>';
         }
     }
 }
开发者ID:engrmostafijur,项目名称:SportsPress,代码行数:16,代码来源:sp-template-functions.php

示例14: Bing_archive_header

/**
	*存档页信息
	*http://www.bgbk.org
*/
function Bing_archive_header()
{
    if (!is_archive()) {
        return;
    }
    if (is_author()) {
        $dashicons = 'admin-users';
        $name = $GLOBALS['authordata']->display_name;
        $description = get_the_author_meta('description');
        $feed_link = get_author_feed_link($GLOBALS['authordata']->ID);
    } elseif (is_date()) {
        $dashicons = 'calendar';
        if (is_day()) {
            $format = __('Y年m月d日', 'Bing');
        } elseif (is_month()) {
            $format = __('Y年m月', 'Bing');
        } else {
            $format = __('Y年', 'Bing');
        }
        $name = get_the_date($format);
        $description = sprintf(__('%s发布的文章', 'Bing'), $name);
    } else {
        $dashicons = is_tag() ? 'tag' : 'category';
        $name = single_term_title('', false);
        $description = term_description();
        $feed_link = get_term_feed_link(get_queried_object_id(), get_queried_object()->taxonomy);
    }
    $description = strip_tags($description);
    ?>
	<div class="span12 archive-header">
		<article class="panel">
			<header class="panel-header">
				<h3>
					<span class="dashicons dashicons-<?php 
    echo $dashicons;
    ?>
"></span><?php 
    echo $name;
    ?>
				</h3>
				<?php 
    if (Bing_mpanel('breadcrumbs')) {
        Bing_breadcrumbs('<span class="separator dashicons dashicons-arrow-right-alt2"></span>', '<span class="right breadcrumb"%s>', '</span>', '<span class="dashicons dashicons-admin-home"></span>' . __('首页', 'Bing'));
    }
    ?>
			</header>
			<?php 
    echo empty($description) ? __('无描述', 'Bing') : $description;
    if (!empty($feed_link)) {
        printf('<a href="%s" title="%s" class="feed-link"><span class="dashicons dashicons-rss"></span></a>', esc_url($feed_link), esc_attr(__('此存档的 Feed 源,可以使用 RSS 阅读器订阅这些内容', 'Bing')));
    }
    ?>
		</article>
	</div>
<?php 
}
开发者ID:w392807287,项目名称:FirstRepository,代码行数:60,代码来源:archive-header.php

示例15: recipe_hero_archive_tax_desc

 function recipe_hero_archive_tax_desc()
 {
     if (is_tax()) {
         $term_description = term_description();
         if (!empty($term_description)) {
             echo apply_filters('category_archive_meta', '<div class="taxonomy-description">' . $term_description . '</div>');
         }
         echo '</div><hr />';
     }
 }
开发者ID:emzo,项目名称:Recipe-Hero,代码行数:10,代码来源:rh-templates-tax-header-functions.php


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