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


PHP is_post_type_archive函数代码示例

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


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

示例1: aviators_option_posts_per_agents_page

function aviators_option_posts_per_agents_page($value)
{
    if (is_post_type_archive('agent')) {
        return aviators_settings_get_value('agents', 'agents', 'per_page');
    }
    return $value;
}
开发者ID:dongchpp,项目名称:BIPHP,代码行数:7,代码来源:agents.php

示例2: 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;
 }
开发者ID:tigerstrikemedia,项目名称:totally-booked,代码行数:34,代码来源:template_tags.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);
}
开发者ID:booklein,项目名称:wpbookle,代码行数:60,代码来源:page-title.php

示例4: display_allowed

 /**
  * Helper function to check whether the shortcode should be rendered or not
  *
  * @return type
  */
 static function display_allowed()
 {
     global $rtmedia_query;
     $flag = !(is_home() || is_post_type_archive() || is_author()) && is_user_logged_in() && (is_rtmedia_upload_music_enabled() || is_rtmedia_upload_photo_enabled() || is_rtmedia_upload_video_enabled()) && (isset($rtmedia_query->is_upload_shortcode) && $rtmedia_query->is_upload_shortcode == true || is_rtmedia_bp_profile() && is_rtmedia_profile_media_enable() || is_rtmedia_bp_group() && is_rtmedia_group_media_enable());
     $flag = apply_filters('before_rtmedia_uploader_display', $flag);
     return $flag;
 }
开发者ID:neerukoul,项目名称:rtMedia,代码行数:12,代码来源:RTMediaUploadShortcode.php

示例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;
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:7,代码来源:utils.php

示例6: widget

 function widget()
 {
     if (!is_user_logged_in()) {
         return;
     }
     $post = get_post();
     switch ($this->post_type) {
         case 'page':
             if ($post->post_type !== 'page') {
                 return;
             }
             break;
         default:
             if ($post->post_type !== $this->post_type && !is_post_type_archive($this->post_type)) {
                 return;
             }
             break;
     }
     $watchlist = get_post_meta($post->ID, '_wporg_watchlist', true);
     if ($watchlist && in_array(get_current_user_id(), $watchlist)) {
         printf('<p>You are watching this page. <a href="%s">Unwatch</a></p>', wp_nonce_url(admin_url('admin-post.php?action=wporg_watchlist&post_id=' . $post->ID), 'unwatch-' . $post->ID));
     } else {
         printf('<p><a href="%s">Watch this page</a></p>', wp_nonce_url(admin_url('admin-post.php?action=wporg_watchlist&watch=1&post_id=' . $post->ID), 'watch-' . $post->ID));
     }
 }
开发者ID:serhi,项目名称:wordpress-sites,代码行数:25,代码来源:widgets.php

示例7: paw_ux_redirect

function paw_ux_redirect()
{
    if (is_post_type_archive('skills')) {
        wp_redirect(home_url(), 301);
        exit;
    }
}
开发者ID:DuyTr,项目名称:project08-client-project,代码行数:7,代码来源:extras.php

示例8: dw_timeline_title

/**
 * Page titles
 */
function dw_timeline_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return get_bloginfo('name');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            return apply_filters('single_term_title', $term->name);
        } elseif (is_post_type_archive()) {
            return apply_filters('the_title', get_queried_object()->labels->name);
        } elseif (is_day()) {
            return sprintf(__('Daily Archives: %s', 'dw-timeline'), get_the_date());
        } elseif (is_month()) {
            return sprintf(__('Monthly Archives: %s', 'dw-timeline'), get_the_date('F Y'));
        } elseif (is_year()) {
            return sprintf(__('Yearly Archives: %s', 'dw-timeline'), get_the_date('Y'));
        } elseif (is_author()) {
            $author = get_queried_object();
            return sprintf(__('Author Archives: %s', 'dw-timeline'), $author->display_name);
        } else {
            return single_cat_title('', false);
        }
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'dw-timeline'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'dw-timeline');
    } else {
        return get_the_title();
    }
}
开发者ID:wenqingyu,项目名称:timeline-post,代码行数:37,代码来源:titles.php

示例9: template_loader

 /**
  * Load a template.
  *
  * Handles template usage so that we can use our own templates instead of the themes.
  *
  * Templates are in the 'templates' folder. eventon looks for theme
  * overrides in /theme/eventon/ by default
  *
  * For beginners, it also looks for a eventon.php template first. If the user adds
  * this to the theme (containing a eventon() inside) this will be used for all
  * eventon templates.
  *
  * @access public
  * @param mixed $template
  * @return string
  */
 public function template_loader($template)
 {
     global $eventon_sin_event, $eventon;
     $file = '';
     $sure_path = AJDE_EVCAL_PATH . '/templates/';
     // Paths to check
     $paths = apply_filters('eventon_template_paths', array(0 => TEMPLATEPATH . '/', 1 => TEMPLATEPATH . '/' . $eventon->template_url));
     $evOpt = evo_get_options('1');
     $events_page_id = evo_get_event_page_id($evOpt);
     // single and archieve events page
     if (is_single() && get_post_type() == 'ajde_events') {
         $file = 'single-ajde_events.php';
         // if this page is event archive page
     } elseif (is_post_type_archive('ajde_events')) {
         $file__ = evo_get_event_template($evOpt);
         $file = $file__;
         $paths[] = $file__ == 'archive-ajde_events.php' ? AJDE_EVCAL_PATH . '/templates/' : get_template_directory();
     }
     // FILE Exist
     if ($file) {
         // each path
         foreach ($paths as $path) {
             if (file_exists($path . $file)) {
                 $template = $path . $file;
                 break;
             }
         }
         if (!$template) {
             $template = AJDE_EVCAL_PATH . '/templates/' . $file;
         }
     }
     //print_r($template);
     return $template;
 }
开发者ID:bpea,项目名称:amtrak-careers,代码行数:50,代码来源:class-evo-template-loader.php

示例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'];
 }
开发者ID:wptailor,项目名称:wc-ajax-product-filter,代码行数:68,代码来源:widget-active-filter.php

示例11: edd_load_scripts

/**
 * Load Scripts
 *
 * Enqueues the required scripts.
 *
 * @since 1.0
 * @global $post
 * @return void
 */
function edd_load_scripts()
{
    global $post;
    $js_dir = EDD_PLUGIN_URL . 'assets/js/';
    // Use minified libraries if SCRIPT_DEBUG is turned off
    $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    // Get position in cart of current download
    if (isset($post->ID)) {
        $position = edd_get_item_position_in_cart($post->ID);
    }
    $has_purchase_links = false;
    if (!empty($post->post_content) && (has_shortcode($post->post_content, 'purchase_link') || has_shortcode($post->post_content, 'downloads')) || is_post_type_archive('download')) {
        $has_purchase_links = true;
    }
    if (edd_is_checkout()) {
        if (edd_is_cc_verify_enabled()) {
            wp_register_script('creditCardValidator', $js_dir . 'jquery.creditCardValidator' . $suffix . '.js', array('jquery'), EDD_VERSION);
            wp_enqueue_script('creditCardValidator');
        }
        wp_register_script('edd-checkout-global', $js_dir . 'edd-checkout-global' . $suffix . '.js', array('jquery'), EDD_VERSION);
        wp_enqueue_script('edd-checkout-global');
        wp_localize_script('edd-checkout-global', 'edd_global_vars', apply_filters('edd_global_checkout_script_vars', array('ajaxurl' => edd_get_ajax_url(), 'checkout_nonce' => wp_create_nonce('edd_checkout_nonce'), 'currency_sign' => edd_currency_filter(''), 'currency_pos' => edd_get_option('currency_position', 'before'), 'decimal_separator' => edd_get_option('decimal_separator', '.'), 'thousands_separator' => edd_get_option('thousands_separator', ','), 'no_gateway' => __('Please select a payment method', 'easy-digital-downloads'), 'no_discount' => __('Please enter a discount code', 'easy-digital-downloads'), 'enter_discount' => __('Enter discount', 'easy-digital-downloads'), 'discount_applied' => __('Discount Applied', 'easy-digital-downloads'), 'no_email' => __('Please enter an email address before applying a discount code', 'easy-digital-downloads'), 'no_username' => __('Please enter a username before applying a discount code', 'easy-digital-downloads'), 'purchase_loading' => __('Please Wait...', 'easy-digital-downloads'), 'complete_purchase' => __('Purchase', 'easy-digital-downloads'), 'taxes_enabled' => edd_use_taxes() ? '1' : '0', 'edd_version' => EDD_VERSION)));
    }
    // Load AJAX scripts, if enabled
    if (!edd_is_ajax_disabled()) {
        wp_register_script('edd-ajax', $js_dir . 'edd-ajax' . $suffix . '.js', array('jquery'), EDD_VERSION);
        wp_enqueue_script('edd-ajax');
        wp_localize_script('edd-ajax', 'edd_scripts', apply_filters('edd_ajax_script_vars', array('ajaxurl' => edd_get_ajax_url(), 'position_in_cart' => isset($position) ? $position : -1, 'has_purchase_links' => $has_purchase_links, 'already_in_cart_message' => __('You have already added this item to your cart', 'easy-digital-downloads'), 'empty_cart_message' => __('Your cart is empty', 'easy-digital-downloads'), 'loading' => __('Loading', 'easy-digital-downloads'), 'select_option' => __('Please select an option', 'easy-digital-downloads'), 'ajax_loader' => set_url_scheme(EDD_PLUGIN_URL . 'assets/images/loading.gif', 'relative'), 'is_checkout' => edd_is_checkout() ? '1' : '0', 'default_gateway' => edd_get_default_gateway(), 'redirect_to_checkout' => edd_straight_to_checkout() || edd_is_checkout() ? '1' : '0', 'checkout_page' => edd_get_checkout_uri(), 'permalinks' => get_option('permalink_structure') ? '1' : '0', 'quantities_enabled' => edd_item_quantities_enabled(), 'taxes_enabled' => edd_use_taxes() ? '1' : '0')));
    }
}
开发者ID:pderksen,项目名称:Easy-Digital-Downloads,代码行数:39,代码来源:scripts.php

示例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(' &gt; ', apply_filters('habakiri_bread_crumb', $bread_crumb)));
 }
开发者ID:ConductiveIO,项目名称:mbrady,代码行数:63,代码来源:class.breadcrumbs.php

示例13: mpp_gallery_archive_redirect

function mpp_gallery_archive_redirect()
{
    if (is_post_type_archive(mpp_get_gallery_post_type()) && mediapress()->is_bp_active() && mpp_get_option('has_gallery_directory') && isset(buddypress()->pages->mediapress->id)) {
        wp_safe_redirect(get_permalink(buddypress()->pages->mediapress->id), 301);
        exit(0);
    }
}
开发者ID:markc,项目名称:mediapress,代码行数:7,代码来源:mpp-hooks.php

示例14: archiveTemplate

 public function archiveTemplate($template)
 {
     if (\is_post_type_archive($this->postType)) {
         $template = __DIR__ . '/templates/archive-template.php';
     }
     return $template;
 }
开发者ID:quandigital,项目名称:wp-quan-jobs,代码行数:7,代码来源:Plugin.php

示例15: template_loader

 /**
  * Load a template.
  *
  * Handles template usage so that we can use our own templates instead of the themes.
  *
  * Templates are in the 'templates' folder. woocommerce looks for theme
  * overrides in /theme/woocommerce/ by default
  *
  * For beginners, it also looks for a woocommerce.php template first. If the user adds
  * this to the theme (containing a woocommerce() inside) this will be used for all
  * woocommerce templates.
  *
  * @param mixed $template
  * @return string
  */
 public function template_loader($template)
 {
     $find = array('woocommerce.php');
     $file = '';
     if (is_single() && get_post_type() == 'product') {
         $file = 'single-product.php';
         $find[] = $file;
         $find[] = WC_TEMPLATE_PATH . $file;
     } elseif (is_tax('product_cat') || is_tax('product_tag')) {
         $term = get_queried_object();
         $file = 'taxonomy-' . $term->taxonomy . '.php';
         $find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
         $find[] = WC_TEMPLATE_PATH . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
         $find[] = $file;
         $find[] = WC_TEMPLATE_PATH . $file;
     } elseif (is_post_type_archive('product') || is_page(wc_get_page_id('shop'))) {
         $file = 'archive-product.php';
         $find[] = $file;
         $find[] = WC_TEMPLATE_PATH . $file;
     }
     if ($file) {
         $template = locate_template($find);
         $status_options = get_option('woocommerce_status_options', array());
         if (!$template || !empty($status_options['template_debug_mode']) && current_user_can('manage_options')) {
             $template = WC()->plugin_path() . '/templates/' . $file;
         }
     }
     return $template;
 }
开发者ID:chhavinav,项目名称:fr.ilovejuice,代码行数:44,代码来源:class-wc-template-loader.php


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