本文整理汇总了PHP中is_tax函数的典型用法代码示例。如果您正苦于以下问题:PHP is_tax函数的具体用法?PHP is_tax怎么用?PHP is_tax使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_tax函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: add_open_field_to_context_search
function add_open_field_to_context_search()
{
if (!(is_post_type_archive('cases') or is_tax('functions'))) {
return;
}
$open = '';
if (isset($_REQUEST['open'])) {
$open = $_REQUEST['open'];
}
?>
<div id="case_open_field_wrapper_cp" class="form-group">
<label for="case_open_field">Открытые</label>
<select type="text" id="case_open_field" class="form-control" name="open">
<option <?php
selected($open, "", true);
?>
value="">Все дела</option>
<option <?php
selected($open, "yes", true);
?>
value="yes">Только открытые дела</option>
<option <?php
selected($open, "no", true);
?>
value="no">Только закрытые дела</option>
</select>
</div>
<?php
}
示例3: porto_page_title
function porto_page_title()
{
global $porto_settings;
$output = '';
if (!is_front_page()) {
} elseif (is_home()) {
$output .= $porto_settings['blog-title'];
}
if (is_singular()) {
$output .= porto_page_title_leaf();
} else {
if (is_post_type_archive()) {
if (is_search()) {
$output .= porto_page_title_leaf('search');
} else {
$output .= porto_page_title_archive();
}
} elseif (is_tax() || is_tag() || is_category()) {
$html = porto_page_title_leaf('term');
if (is_tag()) {
$output .= sprintf(__('Tag - %s', 'porto'), $html);
} elseif (is_tax('product_tag')) {
$output .= sprintf(__('Product Tag - %s', 'porto'), $html);
} else {
$output .= $html;
}
} elseif (is_date()) {
if (is_year()) {
$output .= porto_page_title_leaf('year');
} elseif (is_month()) {
$output .= porto_page_title_leaf('month');
} elseif (is_day()) {
$output .= porto_page_title_leaf('day');
}
} elseif (is_author()) {
$output .= porto_page_title_leaf('author');
} elseif (is_search()) {
$output .= porto_page_title_leaf('search');
} elseif (is_404()) {
$output .= porto_page_title_leaf('404');
} elseif (class_exists('bbPress') && is_bbpress()) {
if (bbp_is_search()) {
$output .= porto_page_title_leaf('bbpress_search');
} elseif (bbp_is_single_user()) {
$output .= porto_page_title_leaf('bbpress_user');
} else {
$output .= porto_page_title_leaf();
}
} else {
if (is_home() && !is_front_page()) {
if (get_option('show_on_front') == 'page') {
$output .= get_the_title(get_option('page_for_posts', true));
} else {
$output .= $porto_settings['blog-title'];
}
}
}
}
return apply_filters('porto_page_title', $output);
}
示例4: tb_archive_title
/**
* Gets The Archive Title Set In The Options, With Normal Defaults.
*
* Pass true to echo instead or returning the value
*
* @param bool $echo
* @return mixed|null|string|void
* @since 0.1
*/
function tb_archive_title($echo = true)
{
$out = __('Archive');
if (is_tax('tb_genre')) {
$opt = get_option('genre_archive_title');
$out = $opt ? $opt : single_term_title('', false);
}
if (is_tax('tb_author')) {
$opt = get_option('author_archive_title');
$out = $opt ? $opt : single_term_title('', false);
}
if (is_tax('tb_series')) {
$opt = get_option('series_archive_title');
$out = $opt ? $opt : single_term_title('', false);
}
if (is_post_type_archive('tb_book')) {
$opt = get_option('book_archive_title');
$out = $opt ? $opt : __('Books Archives', 'totally-booked');
}
if (!$echo) {
return $out;
}
echo $out;
return;
}
示例5: hocwp_is_post_type_archive
function hocwp_is_post_type_archive($post_type)
{
if (is_tax(get_object_taxonomies($post_type)) || is_post_type_archive($post_type)) {
return true;
}
return false;
}
示例6: woothemes_add_css
function woothemes_add_css()
{
global $woo_options;
wp_register_style('prettyPhoto', get_template_directory_uri() . '/includes/css/prettyPhoto.css');
wp_register_style('non-responsive', get_template_directory_uri() . '/css/non-responsive.css');
// Disable prettyPhoto css if WooCommerce is activated and user is on the product page
$woocommerce_activated = is_woocommerce_activated();
$woocommerce_lightbox = get_option('woocommerce_enable_lightbox') == 'yes' ? true : false;
$woocommerce_product = false;
if ($woocommerce_activated) {
$woocommerce_product = is_product();
}
if ($woocommerce_activated && $woocommerce_product && $woocommerce_lightbox) {
wp_deregister_style('prettyPhoto');
}
// Conditionally load the Portfolio CSS, where needed.
$load_portfolio_css = false;
if (is_page_template('template-portfolio.php') || is_singular() && get_post_type() == 'portfolio' || is_post_type_archive('portfolio') || is_tax('portfolio-gallery')) {
$load_portfolio_css = true;
}
// Allow child themes/plugins to load the portfolio CSS when they need it.
$load_portfolio_css = apply_filters('woo_load_portfolio_css', $load_portfolio_css);
if ($load_portfolio_css) {
wp_enqueue_style('prettyPhoto');
}
do_action('woothemes_add_css');
}
示例7: context_check
function context_check($check, $settings)
{
if (empty($settings)) {
return $check;
}
$status = array();
if (!is_array($this->post_types)) {
$this->set_objects();
}
foreach ($this->post_types as $post_type => $post_type_settings) {
if (isset($settings['is_singular-' . $post_type]) && $settings['is_singular-' . $post_type]) {
$status['is_singular-' . $post_type] = is_singular($post_type);
}
if (isset($settings['is_archive-' . $post_type]) && $settings['is_archive-' . $post_type]) {
$status['is_archive-' . $post_type] = is_post_type_archive($post_type);
}
}
foreach ($this->taxonomies as $taxonomy => $tax_settings) {
if (isset($settings['is_tax-' . $taxonomy]) && $settings['is_tax-' . $taxonomy]) {
$status['is_tax-' . $taxonomy] = is_tax($taxonomy);
}
}
$matched = array_intersect_assoc($settings, $status);
if (!empty($matched)) {
return true;
}
return $check;
}
示例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;
}
}
}
示例9: listable_body_classes
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
*
* @return array
*/
function listable_body_classes($classes)
{
// Adds a class of group-blog to blogs with more than 1 published author.
if (is_multi_author()) {
$classes[] = 'group-blog';
}
global $post;
if (has_nav_menu('secondary')) {
$classes[] = 'has--secondary-menu';
}
if (isset($post->post_content) && has_shortcode($post->post_content, 'jobs') || is_search() || is_tax(array('job_listing_category', 'job_listing_tag', 'job_listing_region'))) {
$classes[] = 'page-listings';
}
if (isset($post->post_content) && has_shortcode($post->post_content, 'job_dashboard')) {
$classes[] = 'page-job-dashboard';
}
if (isset($post->post_content) && has_shortcode($post->post_content, 'my_bookmarks')) {
$classes[] = 'page-my-bookmarks';
}
if (isset($post->post_content) && has_shortcode($post->post_content, 'woocommerce_my_account')) {
$classes[] = 'page-login';
}
if (isset($post->post_content) && has_shortcode($post->post_content, 'submit_job_form')) {
$classes[] = 'page-add-listing';
}
if (listable_using_facetwp()) {
$classes[] = 'is--using-facetwp';
}
if (isset($post->post_content) && has_shortcode($post->post_content, 'jobs_by_tag')) {
$classes[] = 'jobs-by-tags-page';
}
return $classes;
}
示例10: widget
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
if (!is_post_type_archive('product') && !is_tax(get_object_taxonomies('product'))) {
return;
}
// enqueue necessary scripts
wp_enqueue_style('wcapf-style');
wp_enqueue_style('font-awesome');
wp_enqueue_script('wcapf-script');
global $wcapf;
$active_filters = $wcapf->getChosenFilters()['active_filters'];
$found = false;
$html = '';
if (sizeof($active_filters) > 0) {
$found = true;
$html .= '<div class="wcapf-active-filters">';
foreach ($active_filters as $key => $active_filter) {
if ($key === 'term') {
foreach ($active_filter as $data_key => $terms) {
foreach ($terms as $term_id => $term_name) {
$html .= '<a href="javascript:void(0)" data-key="' . $data_key . '" data-value="' . $term_id . '">' . $term_name . '</a>';
}
}
}
if ($key === 'keyword') {
$html .= '<a href="javascript:void(0)" data-key="keyword">' . __('Search For: ', 'wcapf') . $active_filter . '</a>';
}
if ($key === 'orderby') {
$html .= '<a href="javascript:void(0)" data-key="orderby">' . __('Orderby: ', 'wcapf') . $active_filter . '</a>';
}
if ($key === 'min_price') {
$html .= '<a href="javascript:void(0)" data-key="min-price">' . __('Min Price: ', 'wcapf') . $active_filter . '</a>';
}
if ($key === 'max_price') {
$html .= '<a href="javascript:void(0)" data-key="max-price">' . __('Max Price: ', 'wcapf') . $active_filter . '</a>';
}
}
$html .= '</div>';
}
extract($args);
// Add class to before_widget from within a custom widget
// http://wordpress.stackexchange.com/questions/18942/add-class-to-before-widget-from-within-a-custom-widget
if ($found === false) {
$widget_class = 'wcapf-widget-hidden woocommerce wcapf-ajax-term-filter';
} else {
$widget_class = 'woocommerce wcapf-ajax-term-filter';
}
// no class found, so add it
if (strpos($before_widget, 'class') === false) {
$before_widget = str_replace('>', 'class="' . $widget_class . '"', $before_widget);
} else {
$before_widget = str_replace('class="', 'class="' . $widget_class . ' ', $before_widget);
}
echo $before_widget;
if (!empty($instance['title'])) {
echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
}
echo $html;
echo $args['after_widget'];
}
示例11: get_posts
function get_posts($query)
{
if (is_tax('series') && $query->is_main_query()) {
$query->set('order', option('order'));
}
return $query;
}
示例12: 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(' > ', apply_filters('habakiri_bread_crumb', $bread_crumb)));
}
示例13: dportfolio_post_archive
/**
* set query post type dportfolio for taxonomy dportfolio_categories
*/
function dportfolio_post_archive($query)
{
if (!is_admin() && is_tax('dportfolio_categories') && $query->is_tax) {
$query->set('post_type', array('dportfolio'));
remove_action('pre_get_posts', 'dportfolio_post_archive');
}
}
示例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}"));
}
示例15: sbg_post_meta
function sbg_post_meta($post_meta)
{
if (is_post_type_archive('staff-member') || is_singular('staff-member') || is_tax('staff-position') || is_page()) {
$post_meta = '[post_terms taxonomy="staff-position" before=""]';
}
return $post_meta;
}