本文整理汇总了PHP中is_archive函数的典型用法代码示例。如果您正苦于以下问题:PHP is_archive函数的具体用法?PHP is_archive怎么用?PHP is_archive使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_archive函数的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: base_getBreadcrumbs
function base_getBreadcrumbs()
{
if (is_404()) {
return false;
}
// Hack to fix breadcrumbs when you're viewing the news home
if (is_home()) {
$post = new \Timber\Post(get_option('page_for_posts'));
} else {
global $post;
}
$breadcrumbs = [];
if ($post->post_parent) {
$parent_id = $post->post_parent;
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = new \Timber\Post($page->ID);
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
}
// Add 'Blog Home' to breadcrumbs if you're on a news post or archive
if ((is_single() || is_archive()) && !is_search()) {
$breadcrumbs[] = new \Timber\Post(get_option('page_for_posts'));
}
return $breadcrumbs;
}
示例3: wp_page_numbers_stylesheet
function wp_page_numbers_stylesheet()
{
$settings = get_option('wp_page_numbers_array');
$head_stylesheet = $settings["head_stylesheetsheet"];
$head_stylesheet_folder_name = $settings["head_stylesheetsheet_folder_name"];
$style_theme = $settings["style_theme"];
if ($head_stylesheet == "on" || $head_stylesheet == "" && (is_archive() || is_search() || is_home() || is_page())) {
echo '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/wp-page-numbers/';
if ($head_stylesheet_folder_name == "") {
if ($style_theme == "default") {
echo 'default';
} elseif ($style_theme == "classic") {
echo 'classic';
} elseif ($style_theme == "tiny") {
echo 'tiny';
} elseif ($style_theme == "panther") {
echo 'panther';
} elseif ($style_theme == "stylish") {
echo 'stylish';
} else {
echo 'default';
}
} else {
echo $head_stylesheet_folder_name;
}
echo '/wp-page-numbers.css" type="text/css" media="screen" />';
}
}
示例4: insert_wp_about_author
function insert_wp_about_author($content)
{
$wp_about_author_settings = array();
$wp_about_author_settings = get_option('wp_about_author_settings');
if (is_front_page() && isset($wp_about_author_settings['wp_author_display_front']) && $wp_about_author_settings['wp_author_display_front']) {
$content = $content . wp_about_author_display();
} else {
if (is_archive() && isset($wp_about_author_settings['wp_author_display_archives']) && $wp_about_author_settings['wp_author_display_archives']) {
$content = $content . wp_about_author_display();
} else {
if (is_search() && isset($wp_about_author_settings['wp_author_display_search']) && $wp_about_author_settings['wp_author_display_search']) {
$content = $content . wp_about_author_display();
} else {
if (is_page() && isset($wp_about_author_settings['wp_author_display_pages']) && $wp_about_author_settings['wp_author_display_pages']) {
$content = $content . wp_about_author_display();
} else {
if (is_single() && isset($wp_about_author_settings['wp_author_display_posts']) && $wp_about_author_settings['wp_author_display_posts']) {
$content = $content . wp_about_author_display();
} else {
if (is_feed() && isset($wp_about_author_settings['wp_author_display_feed']) && $wp_about_author_settings['wp_author_display_feed']) {
$content = $content . wp_about_author_display(true);
} else {
$content = $content;
}
}
}
}
}
}
return $content;
}
示例5: tography_lite_enqueue_stylesheets
function tography_lite_enqueue_stylesheets()
{
//Bootstrap =======================================================
wp_register_style('bootstrap', TOGRAPHY_LITE_CSS . '/bootstrap.css', array(), '3.1', 'all');
wp_enqueue_style('bootstrap');
//=================================================================
if (is_page_template('page-portfolio-thirds.php') || is_archive()) {
//Isotope ================================================
wp_register_style('isotope', TOGRAPHY_LITE_CSS . '/isotope.css', array(), '1.0', 'all');
wp_enqueue_style('isotope');
//=================================================================
//Photoswipe ======================================================
wp_register_style('photoswipe', TOGRAPHY_LITE_CSS . '/photoswipe.css', array(), '2.0.0', 'all');
wp_enqueue_style('photoswipe');
//=================================================================
//Photoswipe Skin ======================================================
wp_register_style('photoswipe-skin', TOGRAPHY_LITE_CSS . '/default-skin/default-skin.css', array(), '2.0.0', 'all');
wp_enqueue_style('photoswipe-skin');
//=================================================================
}
if (is_single() || is_archive()) {
//Photoswipe ======================================================
wp_register_style('photoswipe', TOGRAPHY_LITE_CSS . '/photoswipe.css', array(), '2.0.0', 'all');
wp_enqueue_style('photoswipe');
//=================================================================
//Photoswipe Skin ======================================================
wp_register_style('photoswipe-skin', TOGRAPHY_LITE_CSS . '/default-skin/default-skin.css', array(), '2.0.0', 'all');
wp_enqueue_style('photoswipe-skin');
//=================================================================
}
//Main Stylesheet =================================================
wp_register_style('main-stylesheet', get_bloginfo('stylesheet_url'), array('bootstrap'), '1.0', 'all');
wp_enqueue_style('main-stylesheet');
//=================================================================
}
示例6: 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>';
}
}
}
示例7: thinkup_input_sliderclass
function thinkup_input_sliderclass($classes)
{
global $thinkup_homepage_sliderswitch;
global $thinkup_homepage_sliderpresetwidth;
global $post;
if (!empty($post->ID)) {
$_thinkup_meta_slider = get_post_meta($post->ID, '_thinkup_meta_slider', true);
$_thinkup_meta_sliderpage = get_post_meta($post->ID, '_thinkup_meta_sliderimages', true);
}
if (is_front_page() or thinkup_check_ishome()) {
if (empty($thinkup_homepage_sliderswitch) or $thinkup_homepage_sliderswitch == 'option1') {
if (empty($thinkup_homepage_sliderpresetwidth) or $thinkup_homepage_sliderpresetwidth == '1') {
$classes[] = 'slider-full';
} else {
$classes[] = 'slider-boxed';
}
}
} else {
if (!is_front_page() and !thinkup_check_ishome() and !is_archive() and !thinkup_check_isblog() and $_thinkup_meta_slider == 'on') {
if (is_array($_thinkup_meta_sliderpage)) {
if ($_thinkup_meta_sliderpage['full_width'] == 'on') {
$classes[] = 'slider-full';
} else {
$classes[] = 'slider-boxed';
}
}
}
}
return $classes;
}
示例8: reactor_do_tumblog_icons
/**
* Post Tumblog Icons
* in all formats when tumblog icons are enabled
*
* @since 1.0.0
*/
function reactor_do_tumblog_icons()
{
if (reactor_option('tumblog_icons', false) && (is_home() || is_archive()) && current_theme_supports('reactor-tumblog-icons')) {
$output = reactor_tumblog_icon();
echo $output;
}
}
示例9: galanight_scripts_styles
/**
* Enqueues scripts and styles for front-end.
*
*/
function galanight_scripts_styles()
{
global $wp_styles, $wp_scripts, $galanight_options_db;
// Adds JavaScript
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
if ($galanight_options_db['galanight_infinite_scroll'] != 'Disable') {
if (is_home() || is_archive() || is_search()) {
wp_enqueue_script('galanight-infinitescroll', get_template_directory_uri() . '/js/infinitescroll.js', array('jquery'), '2.0.2', true);
wp_enqueue_script('galanight-infinitescroll-settings', get_template_directory_uri() . '/js/infinitescroll-settings.js', array(), '1.0', true);
$galanight_site_parameters = array('theme_directory' => get_template_directory_uri(), 'message_load' => __('<p>Loading...</p>', 'galanight'), 'message_end' => __('<p>No further posts.</p>', 'galanight'));
wp_localize_script('galanight-infinitescroll-settings', 'SiteParameters', $galanight_site_parameters);
}
}
wp_enqueue_script('galanight-placeholders', get_template_directory_uri() . '/js/placeholders.js', array('jquery'), '2.0.8', true);
if ($galanight_options_db['galanight_display_scroll_top'] != 'Hide') {
wp_enqueue_script('galanight-scroll-to-top', get_template_directory_uri() . '/js/scroll-to-top.js', array('jquery'), '1.0', true);
}
if (has_nav_menu('main-navigation') && $galanight_options_db['galanight_header_layout'] == 'Centered' && !is_page_template('template-landing-page.php')) {
wp_enqueue_script('galanight-menubox', get_template_directory_uri() . '/js/menubox.js', array(), '1.0', true);
}
wp_enqueue_script('galanight-selectnav', get_template_directory_uri() . '/js/selectnav.js', array(), '0.1', true);
wp_enqueue_script('galanight-responsive', get_template_directory_uri() . '/js/responsive.js', array(), '1.0', true);
wp_enqueue_script('galanight-html5-ie', get_template_directory_uri() . '/js/html5.js', array(), '3.6', false);
$wp_scripts->add_data('galanight-html5-ie', 'conditional', 'lt IE 9');
// Adds CSS
wp_enqueue_style('galanight-elegantfont', get_template_directory_uri() . '/css/elegantfont.css');
wp_enqueue_style('galanight-google-font-default', '//fonts.googleapis.com/css?family=Oswald&subset=latin,latin-ext');
if (class_exists('woocommerce')) {
wp_enqueue_style('galanight-woocommerce-custom', get_template_directory_uri() . '/css/woocommerce-custom.css');
}
}
示例10: dbdb_body_classes
/**
* Custom class for the WP 'body_class()' function
* updated: 4/15/10
*/
function dbdb_body_classes($classes)
{
// source http://darrinb.com/notes/2010/customizing-the-wordpress-body_class-function/
global $post;
global $wp_query;
// if there is no parent ID and it's not a single post page, category page, or 404 page, give it
// a class of "parent-page"
if ($post->post_parent < 1 && !is_single() && !is_archive() && !is_404()) {
$classes[] = 'parent-page';
}
// if the page/post has a parent, it's a child, give it a class of its parent name
if ($post->post_parent > 0) {
/* $parent_title = get_the_title($wp_query->post->post_parent);
$parent_title = preg_replace('#\s#','-', $parent_title);
$parent_title = strtolower($parent_title);
$classes[] = 'parent-pagename-'.$parent_title; */
$parent_id = wp_get_post_parent_id($wp_query->post);
// $parent_id = get_the_ID($wp_query->post->post_parent);
echo "PARENT ID : " . $parent_id;
// $parent_id = preg_replace('#\s#','-', $parent_id);
$parent_id = strtolower($parent_id);
$classes[] = 'parent-id-' . $parent_id;
}
// add a class = to the name of post or page
$classes[] = $wp_query->queried_object->post_name;
return array_unique($classes);
}
示例11: shootingstar_scripts_styles
/**
* Enqueues scripts and styles for front-end.
*
*/
function shootingstar_scripts_styles()
{
global $wp_styles, $wp_scripts;
// Adds JavaScript
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
if (get_theme_mod('shootingstar_infinite_scroll') != 'Disable') {
if (is_home() || is_archive() || is_search()) {
wp_enqueue_script('shootingstar-infinitescroll', get_template_directory_uri() . '/js/infinitescroll.min.js', array('jquery'), '2.0.2', true);
wp_enqueue_script('shootingstar-infinitescroll-settings', get_template_directory_uri() . '/js/infinitescroll-settings.js', array(), '1.0', true);
$shootingstar_site_parameters = array('theme_directory' => get_template_directory_uri(), 'message_load' => __('<p>Loading...</p>', 'shootingstar'), 'message_end' => __('<p>No further posts.</p>', 'shootingstar'));
wp_localize_script('shootingstar-infinitescroll-settings', 'SiteParameters', $shootingstar_site_parameters);
}
}
wp_enqueue_script('shootingstar-placeholders', get_template_directory_uri() . '/js/placeholders.js', array('jquery'), '2.0.8', true);
if (get_theme_mod('shootingstar_display_scroll_top') != 'Hide') {
wp_enqueue_script('shootingstar-scroll-to-top', get_template_directory_uri() . '/js/scroll-to-top.js', array('jquery'), '1.0', true);
}
if (get_theme_mod('shootingstar_fixed_menu') != 'Disable' && !is_page_template('template-landing-page.php')) {
wp_enqueue_script('shootingstar-menubox', get_template_directory_uri() . '/js/menubox.js', array(), '1.0', true);
}
wp_enqueue_script('shootingstar-selectnav', get_template_directory_uri() . '/js/selectnav.js', array(), '0.1', true);
wp_enqueue_script('shootingstar-responsive', get_template_directory_uri() . '/js/responsive.js', array(), '1.0', true);
wp_enqueue_script('shootingstar-html5-ie', get_template_directory_uri() . '/js/html5.min.js', array(), '3.7.2', false);
$wp_scripts->add_data('shootingstar-html5-ie', 'conditional', 'lt IE 9');
// Adds CSS
wp_enqueue_style('shootingstar-elegantfont', get_template_directory_uri() . '/css/elegantfont.css');
wp_enqueue_style('shootingstar-google-font-default', '//fonts.googleapis.com/css?family=PT+Sans&subset=latin,latin-ext');
if (class_exists('woocommerce')) {
wp_enqueue_style('shootingstar-woocommerce-custom', get_template_directory_uri() . '/css/woocommerce-custom.css');
}
}
示例12: _act_get_body_data
function _act_get_body_data()
{
global $post;
$body_data = array();
// echo 'pid';
//
$post_type = get_post_type(get_the_ID());
if (is_archive()) {
$post_type = "archive";
}
if (is_front_page()) {
$post_type = 'home';
}
$body_data['post-type'] = $post_type;
$post_slug = $post->post_name;
if (is_archive() and isset(get_queried_object()->taxonomy)) {
$tax = get_taxonomy(get_queried_object()->taxonomy);
$post_slug = sanitize_title($tax->labels->singular_name);
} elseif (is_archive() and !isset(get_queried_object()->taxonomy)) {
$post_slug = get_queried_object()->name;
}
if (is_home()) {
$post_slug = 'blog';
}
if (is_home() && is_paged()) {
$post_slug = 'blog_paged';
}
$body_data['post-slug'] = $post_slug;
return $body_data;
}
示例13: sosimple_pagination
/**
* Print the previous and next links depending on the current template.
*/
function sosimple_pagination()
{
global $wp_query;
if (is_single()) {
?>
<nav class="nav single-nav" role="navigation">
<span class="home"><a href="<?php
echo esc_url(home_url('/'));
?>
"></a></span>
</nav>
<?php
} elseif ($wp_query->max_num_pages > 1 && (is_home() || is_archive() || is_search())) {
?>
<nav class="nav paged-nav" role="navigation">
<span class="previous"><?php
previous_posts_link('');
?>
</span>
<span class="next"><?php
next_posts_link('');
?>
</span>
</nav>
<?php
}
}
示例14: willow_the_content_filter
function willow_the_content_filter($content)
{
if (is_home() || is_archive()) {
$content = willow_make_excerpt($content);
}
return $content;
}
示例15: custom_get_wpml_language_link
/**
* Function: custom_get_wpml_language_link - custom code for getting wpml language toggle link
* Author: JF
* Date: May 29, 2014
*/
function custom_get_wpml_language_link()
{
global $post, $current_child_site, $wp_query, $home_url;
$wpml_post_name = '';
//get current inactive language code
$get_inactive_language = custom_get_inactive_language();
// get the post ID in en
$wpml_post_id = icl_object_id($post->ID, $post->post_type, true, $get_inactive_language['language_code']);
// get the post object
$wpml_post_obj = get_post($wpml_post_id);
// get the name
$wpml_post_name = $wpml_post_obj->post_name;
if (is_archive()) {
$wpml_post_name = $wp_query->query['post_type'];
}
if (is_singular('cpt')) {
$wpml_post_name = 'cpt/' . $wpml_post_name;
}
if (is_front_page()) {
$wpml_post_name = '';
}
if (is_home()) {
//check home blog listing
//$wpml_post_name = 'blog';
}
if (is_page()) {
$translated_url = get_permalink($wpml_post_id);
return '<a href="' . $translated_url . '">' . $get_inactive_language['native_name'] . '</a>';
} else {
//output language switch link
return '<a href="' . $home_url . '/' . $get_inactive_language['language_code'] . '/' . $wpml_post_name . '/">' . $get_inactive_language['native_name'] . '</a>';
}
}