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

PHP is_category函数代码示例

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

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



在下文中一共展示了is_category函数的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: bootstrap_breadcrumbs

/**
 * Add breadcrumbs functionality to your WordPress theme
 *
 * Once you have included the function in your functions.php file
 * you can then place the following anywhere in your theme templates
 * if(function_exists('bootstrap_breadcrumbs')) bootstrap_breadcrumbs();
 *
 * credit to: c.bavota - http://bavotasan.com (thanks for the code start)
 */
function bootstrap_breadcrumbs()
{
    echo '<ol class="breadcrumb">';
    echo '<li><a href="' . home_url('/') . '">Home</a></li>';
    // are we at "blog home"?
    if (is_home()) {
        echo '<li><a href="#">Blogs</a></li>';
    }
    // where else do we want breadcrumbs
    if (!is_page_template('pt-home.php') && !is_home()) {
        // check if we're in a commerce plugin
        if (function_exists('is_woocommerce') && is_woocommerce()) {
            echo '<li><a href="/publications/order/">Shop</a></li>';
            $product_cats = wp_get_post_terms(get_the_ID(), 'product_cat');
            echo '<li><a href="/publications/order/' . str_replace(" ", "-", $product_cats[0]->name) . '">' . $product_cats[0]->name . '</a></li>';
        }
        // breadcrumb wordpress structures
        if (is_category() || is_single() || is_single('aof')) {
            if (get_the_category()) {
                $category = get_the_category();
                echo '<li><a href="/blog/category/' . str_replace(" ", "-", $category[0]->cat_name) . '">' . $category[0]->cat_name . '</a></li>';
            }
            if (is_single()) {
                echo '<li class="active">';
                the_title();
                echo '</li>';
            }
        } elseif (is_page()) {
            echo '<li class="active">';
            the_title();
            echo '</li>';
        }
    }
    echo '</ol>';
}
开发者ID:ethicalux,项目名称:kairos_eux,代码行数:44,代码来源:wp_bootstrap_breadcrumbs.php


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


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


示例5: MyBreadcrumb

function MyBreadcrumb()
{
    if (!is_home()) {
        echo '<li><a href="';
        echo get_option('home');
        echo '/">';
        echo 'Home';
        echo '</a><span class="divider">/</span></li>';
        if (is_category() || is_single()) {
            echo '<li>';
            the_category(', ', '&title_li=');
            echo '<span class="divider">/</span></li>';
            echo '</li>';
            if (is_single()) {
                echo '<li class="active">';
                // the_title();
                echo '</li>';
            }
        } elseif (is_page()) {
            echo '<li class="active">';
            the_title();
            echo '</li>';
        }
    }
}
开发者ID:sykot,项目名称:wp-bs,代码行数:25,代码来源:functions.php


示例6: my_get_posts

function my_get_posts($query)
{
    if (is_author() && $query->is_main_query() || is_category() && $query->is_main_query()) {
        $query->set('post_type', array('post', 'resources', 'news'));
    }
    return $query;
}
开发者ID:alastair38,项目名称:begood2016,代码行数:7,代码来源:functions.php


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


示例8: getWordPressPageType

 /**
  * Gets the page type from WordPress.
  *
  * @return string A string representation of the current page type,
  *     corresponding to the values used by publisherplugin.google.com.
  */
 public static function getWordPressPageType()
 {
     // is_front_page() returns true if (1) a static front page is set and this
     // is that page, or (2) the front page is the blog home page and this
     // is the blog home page.
     if (is_front_page()) {
         return 'front';
     }
     if (is_home()) {
         return 'home';
     }
     if (is_single()) {
         return 'singlePost';
     }
     if (is_page()) {
         return 'page';
     }
     if (is_category()) {
         return 'category';
     }
     if (is_archive()) {
         return 'archive';
     }
     if (is_search()) {
         return 'search';
     }
     if (is_404()) {
         return 'errorPage';
     }
     return '';
 }
开发者ID:thabofletcher,项目名称:tc-site,代码行数:37,代码来源:Utils.php


示例9: tags

 public function tags()
 {
     if (!did_action('pre_get_posts')) {
         return array();
     }
     $queried_object = get_queried_object();
     $tags = array();
     $default_tags = array('og:type' => 'website', 'og:locale' => get_locale(), 'og:site_name' => get_bloginfo('name'), 'og:image' => $this->get_image_url());
     if (is_front_page()) {
         $tags = array('og:url' => home_url('/'), 'og:title' => get_bloginfo('name'), 'og:description' => get_bloginfo('description'));
     } else {
         if (is_singular()) {
             $tags = array('og:type' => 'article', 'og:url' => get_permalink($queried_object), 'og:title' => get_the_title($queried_object), 'og:description' => $this->generate_preview($queried_object->post_content), 'article:published_time' => date('c', strtotime($queried_object->post_date_gmt)), 'article:modified_time' => date('c', strtotime($queried_object->post_modified_gmt)), 'article:author' => get_author_posts_url($queried_object->post_author));
         } else {
             if (is_tax() || is_category() || is_tag()) {
                 $tags = array('og:url' => get_term_link($queried_object), 'og:title' => $queried_object->name, 'og:description' => $this->generate_preview($queried_object->description));
             } else {
                 if (is_author()) {
                     $tags = array('og:type' => 'profile', 'og:url' => get_author_posts_url($queried_object->ID), 'og:title' => $queried_object->display_name, 'og:description' => $this->generate_preview($queried_object->user_description), 'profile:first_name' => get_the_author_meta('first_name', $queried_object->ID), 'profile:last_name' => get_the_author_meta('last_name', $queried_object->ID));
                 }
             }
         }
     }
     $tags = array_merge($default_tags, $tags);
     return apply_filters('appthemes_open_graph_meta_tags', $tags);
 }
开发者ID:kalushta,项目名称:darom,代码行数:26,代码来源:open-graph.php


示例10: mypace_custom_navi_menu

function mypace_custom_navi_menu($classes, $item)
{
    global $wp_query;
    $singular_slug = 'service';
    $page_for_custom_type_title = 'サービス';
    $page_for_posts = get_option('page_for_posts');
    $post_type_query = $wp_query->query_vars['post_type'];
    $del_flag = true;
    $add_flag = false;
    if (is_singular('post') || is_category() || is_tag()) {
        $del_flag = false;
    } elseif (is_author() || is_date() || is_author()) {
        if (in_array($post_type_query, array('', 'post'))) {
            $del_flag = false;
        } elseif ($post_type_query == $custom_post_type) {
            $add_flag = true;
        }
    } elseif (is_tax()) {
        $taxonomy = get_taxonomy($wp_query->query_vars['taxonomy']);
        if (count($taxonomy->object_type) == 1 && $taxonomy->object_type[0] == 'post') {
            $del_flag = false;
        } elseif (count($taxonomy->object_type) == 1 && $taxonomy->object_type[0] == $singular_slug) {
            $add_flag = true;
        }
    } elseif (is_singular($singular_slug)) {
        $add_flag = true;
    }
    if ($del_flag && is_numeric($page_for_posts) && $item->object_id == $page_for_posts && $item->object == 'page' && ($key = array_search('current_page_parent', $classes))) {
        unset($classes[$key]);
    } elseif ($add_flag && $item->title == $page_for_custom_type_title && $item->object == 'page') {
        $classes[] = 'current_page_parent';
    }
    return $classes;
}
开发者ID:k111,项目名称:wp_theme_skeleton,代码行数:34,代码来源:functions.php


示例11: get_breadcrumbs

function get_breadcrumbs($post)
{
    echo "<li itemscope itemtype=\"http://data-vocabulary.org/Breadcrumb\"><a href=" . get_bloginfo('url') . " itemprop=\"url\"><span itemprop=\"title\">Home</span></a><span class=arrow>&nbsp;&nbsp;>&nbsp;&nbsp;</span></li>";
    if (is_home()) {
        $breadcrumbs[] = '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="' . get_permalink($page->ID) . '" title="" itemprop="url"><span itemprop="title">' . single_post_title($page->ID) . '</span></a><span class=arrow>&nbsp;&nbsp;>&nbsp;&nbsp;</span></li>';
    } elseif (is_single() || is_page()) {
        $parent_id = $post->post_parent;
        $breadcrumbs = array();
        while ($parent_id) {
            $page = get_page($parent_id);
            $breadcrumbs[] = '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="' . get_permalink($page->ID) . '" title="" itemprop="url"><span itemprop="title">' . get_the_title($page->ID) . '</span></a><span class=arrow>&nbsp;&nbsp;>&nbsp;&nbsp;</span></li>';
            $parent_id = $page->post_parent;
        }
        $breadcrumbs = array_reverse($breadcrumbs);
        foreach ($breadcrumbs as $crumb) {
            echo $crumb;
        }
        echo "<li itemscope itemtype=\"http://data-vocabulary.org/Breadcrumb\"><span itemprop=\"title\">" . $post->post_title . "</span></li>";
    } elseif (is_category()) {
        echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="' . get_permalink($page->ID) . '" title="" itemprop="url"><span itemprop="title">' . single_cat_title($page->ID) . '</span></a></li>';
    } elseif (is_archive()) {
        echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">Archives</span></li>';
    } elseif (is_404()) {
        echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">404 Page Not Found</span></li>';
    }
}
开发者ID:breakthroughdesign,项目名称:qaulitrol,代码行数:26,代码来源:functions.php


示例12: kb_scripts

function kb_scripts()
{
    wp_enqueue_style('Google-Fonts', 'https://fonts.googleapis.com/css?family=Roboto:300,400|Open+Sans:400,600,700');
    wp_enqueue_style('Normalizer', get_template_directory_uri() . '/normalize.css');
    wp_enqueue_style('Chosen', get_template_directory_uri() . '/chosen/chosen.css');
    wp_enqueue_style('Dropzone', get_template_directory_uri() . '/css/dropzone.css');
    wp_enqueue_style('Main', get_stylesheet_uri(), array(), '1.01', false);
    wp_enqueue_script('bx-js', get_template_directory_uri() . '/js/jquery.bxslider.min.js', array('jquery'), '1.0.1', true);
    wp_enqueue_script('easing-js', get_template_directory_uri() . '/js/jquery.easing.1.3.js', array('jquery'), '1.0.1', true);
    wp_enqueue_script('chosen-js', get_template_directory_uri() . '/js/chosen.jquery.min.js', array('jquery'), '1.0.1', true);
    wp_enqueue_script('custom-js', get_template_directory_uri() . '/js/custom.js', array('jquery'), '1.0.1', true);
    if (is_page_template(array('page-create-basic-listing.php', 'page-edit-basic-listing.php', 'page-create-paid-listing.php', 'page-edit-paid-listing.php', 'page-create-basic-listing-fr.php', 'page-edit-basic-listing-fr.php', 'page-create-paid-listing-fr.php', 'page-edit-paid-listing-fr.php'))) {
        wp_enqueue_script('dropzone', get_template_directory_uri() . '/js/dropzone.js', array('jquery'), '1.0.1', 'true');
    }
    //		if(is_page_template(array('page-create-paid-listing.php', 'page-edit-paid-listing.php'))) {
    //			wp_enqueue_script('stripejs', 'https://js.stripe.com/v2/', array(''), '1.0.1', 'false');
    //		}
    if (is_page_template('page-paid-listing.php')) {
        wp_register_script('googlemap', 'https://maps.google.com/maps/api/js?sensor=false', 'jquery');
        wp_enqueue_script('googlemap');
    }
    if (!is_admin()) {
        wp_localize_script('custom-js', 'my_ajax', array('ajaxurl' => admin_url('admin-ajax.php')));
    }
    if (is_home() || is_category() || is_archive()) {
        wp_enqueue_script('blog-js', get_template_directory_uri() . '/js/ajax-blog.js', array('jquery'), '1.0.1', true);
        global $wp_query;
        // What page are we on? And what is the pages limit?
        $max = $wp_query->max_num_pages;
        $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
        // Add some parameters for the JS.
        wp_localize_script('blog-js', 'pbd_alp', array('startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts($max, false)));
    }
}
开发者ID:altim,项目名称:kallababy,代码行数:34,代码来源:functions.php


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


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


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


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


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


示例18: render

 function render($atts, $content = null)
 {
     $atts['limit'] = 5;
     parent::render($atts);
     // sets the live atts, $this->atts, $this->block_uid, $this->td_query (it runs the query)
     if (is_category()) {
         // we have no related posts to display
         if ($this->td_query->post_count == 0) {
             return '<div class="td_line_above_cat_big_grid"> </div>';
         }
         /** if we have posts in the big grid and we are on a category, do not show the default page no posts message. @see td_global::$custom_no_posts_message */
         td_global::$custom_no_posts_message = false;
     }
     $buffy = '';
     //output buffer
     //get the js for this block
     $buffy .= $this->get_block_js();
     $buffy .= '<div class="' . $this->get_block_classes() . '">';
     //get the block title
     $buffy .= $this->get_block_title();
     //get the sub category filter for this block
     $buffy .= $this->get_pull_down_filter();
     $buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">';
     $buffy .= $this->inner($this->td_query->posts);
     //inner content of the block
     $buffy .= '</div>';
     //get the ajax pagination for this block
     $buffy .= $this->get_block_pagination();
     $buffy .= '</div> <!-- ./block -->';
     $buffy .= '<div class="clearfix"></div>';
     return $buffy;
 }
开发者ID:vikasjain1595,项目名称:wordpresstheme,代码行数:32,代码来源:td_block_big_grid.php


示例19: homeType

function homeType($classes)
{
    // Add the class when needed
    $HomebgType = get_option('_tdCore-home-bgType');
    $iC = '';
    $end = '';
    foreach (get_the_category() as $category) {
        $postcat = $category->cat_ID;
        $catname = $category->cat_name;
        $catslug = $category->category_nicename;
        if (is_category($catslug)) {
            $end = $postcat;
        }
    }
    $args = array('orderby' => 'name', 'order' => 'ASC');
    $categories = get_categories($args);
    foreach ($categories as $cat) {
        $iC++;
        if ($cat->name != '') {
            if ($end == $cat->cat_ID) {
                $catname = $cat->name;
                $count = get_option('portfolioType' . $iC);
                $count = strtolower($count);
                $classes[] = 'body-' . $count;
            }
        }
    }
    if (is_front_page()) {
        $classes[] = 'body-' . $HomebgType;
    }
    return $classes;
}
开发者ID:nishant368,项目名称:newlifeoffice-new,代码行数:32,代码来源:functions.php


示例20: check_language_code_in_url

 public function check_language_code_in_url()
 {
     global $wp_query, $post;
     if (is_single() || is_page()) {
         if (isset($post->ID) && $this->model->is_translated_post_type($post->post_type)) {
             $language = $this->model->get_post_language((int) $post->ID);
         }
     } elseif (is_category() || is_tag() || is_tax()) {
         $obj = $wp_query->get_queried_object();
         if ($this->model->is_translated_taxonomy($obj->taxonomy)) {
             $language = $this->model->get_term_language((int) $obj->term_id);
         }
     } elseif ($wp_query->is_posts_page) {
         $obj = $wp_query->get_queried_object();
         $language = $this->model->get_post_language((int) $obj->ID);
     }
     // the language is not correctly set so let's redirect to the correct url for this object
     if (!empty($language)) {
         $requested_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
         $redirect_url = $this->links_model->switch_language_in_link($requested_url, $language);
         if ($requested_url != $redirect_url) {
             wp_redirect($redirect_url, 301);
             exit;
         }
     }
 }
开发者ID:MaryMaffka,项目名称:dpm,代码行数:26,代码来源:choose-lang-url.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP is_cert_revoked函数代码示例发布时间:2022-05-15
下一篇:
PHP is_cart函数代码示例发布时间: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