本文整理匯總了PHP中is_singular函數的典型用法代碼示例。如果您正苦於以下問題:PHP is_singular函數的具體用法?PHP is_singular怎麽用?PHP is_singular使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了is_singular函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: wpex_blog_exclude_categories
function wpex_blog_exclude_categories()
{
// Wait..we don't want to be in these plages? Lets leave now!
if (is_admin()) {
return;
}
if (is_search()) {
return;
}
if (is_archive()) {
return;
}
// Categories to exclude
$cats_to_exclude = wpex_option('blog_cats_exclude');
// Admin option is blank, so bail.
if ($cats_to_exclude == '') {
return;
}
// Blog template
if (is_home() && !is_singular('page')) {
$exclude = $cats_to_exclude;
} else {
return;
// Do nothing, ok?
}
if ($cats_to_exclude) {
set_query_var('category__not_in', $cats_to_exclude);
}
}
示例2: orbis_subscriptions_render_company_subscriptions
/**
* Orbis company subscriptions
*/
function orbis_subscriptions_render_company_subscriptions()
{
if (is_singular('orbis_company')) {
global $orbis_subscriptions_plugin;
$orbis_subscriptions_plugin->plugin_include('templates/company-subscriptions.php');
}
}
示例3: page_id
/**
* get the current page ID.
*
* @return int the current page ID.
*/
public function page_id()
{
global $post;
if (isset($post)) {
/**
* Get the current post ID
*/
$id = $post->ID;
/**
* If we're on the posts page, get the ID of the page
* using the 'page_for_posts' option.
*/
if (is_home()) {
$id = get_option('page_for_posts');
} else {
/**
* I we're on the WooCommerce shop page, get the ID of the page
* using the 'woocommerce_shop_page_id' option
*/
if (function_exists('is_shop') && is_shop()) {
$id = get_option('woocommerce_shop_page_id');
} else {
/**
* If this is a singular page/post then set ID to the page ID.
* If not, then set it to false.
*/
$id = is_singular() ? $post->ID : false;
}
}
} else {
$id = false;
}
return $id;
}
示例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);
}
示例5: understrap_scripts
/**
* understrap enqueue scripts
*
* @package understrap
*/
function understrap_scripts()
{
// wp_enqueue_style( 'understrap-theme', get_stylesheet_directory_uri() . '/css/theme.min.css', array(), '0.2.8', false );
wp_enqueue_style('understrap-theme', get_stylesheet_directory_uri() . '/css/theme.css', array(), '0.2.8', false);
// wp_enqueue_script('jquery');
wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery.js', array(), '2.1.4', false);
wp_enqueue_script('understrap-navigation', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '20120206', true);
wp_enqueue_script('understrap-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true);
// angular relations
wp_enqueue_script('angular', get_template_directory_uri() . '/js/angular.js', array(), '1.4.9', true);
wp_enqueue_script('angular-ui-router', '//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.17/angular-ui-router.min.js', array(), '0.2.17', true);
wp_enqueue_script('angular-animate', '//ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular-animate.js', array(), '1.4.9', true);
wp_enqueue_script('angular-sanitize', '//ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular-sanitize.min.js', array(), '1.4.9', true);
wp_enqueue_script('ui-bootstrap', '//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.1.2.js', array(), '1.1.2', true);
// Angualr APP
wp_enqueue_script('app', get_template_directory_uri() . '/js/app.js', array(), null, true);
// Custom JS
wp_enqueue_script('script', get_template_directory_uri() . '/js/script.js', array(), null, true);
// NON SASS CSS
wp_enqueue_style('animate', get_stylesheet_directory_uri() . '/css/animate.css', array(), '0.2.8', false);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
if (is_active_sidebar('hero')) {
wp_enqueue_style('understrap-carousel-style', get_template_directory_uri() . '/css/owl.carousel.css', array(), '20024', false);
wp_enqueue_script('understrap-carousel-script', get_template_directory_uri() . '/js/owl.carousel.min.js', array(), '20024', true);
}
}
示例6: mb_scripts
/**
* Enqueue scripts
*/
function mb_scripts()
{
wp_enqueue_style('_mbbasetheme-style', get_stylesheet_uri());
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
示例7: post_availability
function post_availability($content)
{
$out = '';
if (is_singular()) {
$languages = icl_get_languages('skip_missing=true');
if (1 < count($languages)) {
//$out .= $this->settings['post_available_before'] ? $this->settings['post_available_before'] : '';
foreach ($languages as $l) {
if (!$l['active']) {
$langs[] = '<a href="' . apply_filters('WPML_filter_link', $l['url'], $l) . '">' . $l['translated_name'] . '</a>';
}
}
$out .= join(', ', $langs);
//$out .= $this->settings['post_available_after'] ? $this->settings['post_available_after'] : '';
if (!function_exists('icl_t')) {
function icl_t($c, $n, $str)
{
return $str;
}
}
$out = '<p class="icl_post_in_other_langs">' . sprintf(icl_t('WPML', 'Text for alternative languages for posts', $this->settings['icl_post_availability_text']), $out) . '</p>';
}
}
if ($this->settings['icl_post_availability_position'] == 'above') {
return $out . $content;
} else {
return $content . $out;
}
}
示例8: bones_scripts_and_styles
function bones_scripts_and_styles()
{
global $wp_styles;
// call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
if (!is_admin()) {
// modernizr and main stylesheets
wp_register_script('bones-modernizr', get_stylesheet_directory_uri() . '/assets/js/libs/modernizr.custom.min.js', array(), '2.5.3', false);
wp_register_style('bones-stylesheet', get_stylesheet_directory_uri() . '/assets/css/style.min.css', array(), '', 'all');
wp_register_style('bones-owlcarousel-css', get_stylesheet_directory_uri() . '/assets/vendor/owl.carousel/dist/assets/owl.carousel.min.css', array(), '', 'all');
wp_register_style('bones-owlcarousel-theme', get_stylesheet_directory_uri() . '/assets/vendor/owl.carousel/dist/assets/owl.theme.default.min.css', array(), '', 'all');
wp_register_style('bones-ie-only', get_stylesheet_directory_uri() . '/assets/css/ie.min.css', array(), '');
// comment reply script for threaded comments
if (is_singular() and comments_open() and get_option('thread_comments') == 1) {
wp_enqueue_script('comment-reply');
}
//adding scripts file in the footer
wp_register_script('bones-js', get_stylesheet_directory_uri() . '/assets/js/scripts.js', array('jquery'), '', true);
wp_register_script('bones-quickshare', get_stylesheet_directory_uri() . '/assets/vendor/quickshare/dist/quickshare.min.js', array('jquery'), '', true);
wp_register_script('bones-owlcarousel-js', get_stylesheet_directory_uri() . '/assets/vendor/owl.carousel/dist/owl.carousel.min.js', array('jquery'), '', true);
wp_enqueue_script('bones-modernizr');
wp_enqueue_style('bones-stylesheet');
wp_enqueue_style('bones-owlcarousel-css');
wp_enqueue_style('bones-owlcarousel-theme');
wp_enqueue_style('bones-ie-only');
$wp_styles->add_data('bones-ie-only', 'conditional', 'lt IE 9');
// add conditional wrapper around ie stylesheet
wp_enqueue_script('jquery');
wp_enqueue_script('bones-js');
wp_enqueue_script('bones-quickshare');
wp_enqueue_script('bones-owlcarousel-js');
}
}
示例9: javo_lister_redirect_disabled
function javo_lister_redirect_disabled($redirect_url)
{
if (is_singular('lister')) {
$redirect_url = false;
}
return $redirect_url;
}
示例10: site_scripts
function site_scripts()
{
global $wp_styles;
// Call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
// Removes WP version of jQuery
wp_deregister_script('jquery');
// Load jQuery files in header - load in header to avoid issues with plugins
wp_enqueue_script('jquery', get_template_directory_uri() . '/vendor/jquery/dist/jquery.min.js', array(), '', true);
// Load What-Input files in footer
wp_enqueue_script('what-input', get_template_directory_uri() . '/vendor/what-input/what-input.min.js', array(), '', true);
// Adding Foundation scripts file in the footer
wp_enqueue_script('foundation-js', get_template_directory_uri() . '/assets/js/foundation.min.js', array('jquery'), '6.0', true);
// Adding scripts file in the footer
wp_enqueue_script('site-js', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), '', true);
// Register main stylesheet
wp_enqueue_style('site-css', get_template_directory_uri() . '/assets/css/style.min.css', array(), '', 'all');
// Register custom stylesheet
wp_enqueue_style('dragoncove-css', get_template_directory_uri() . '/assets/css/dragoncove-style.css', array(), '', 'all');
// Register custom stylesheet
wp_enqueue_style('dragoncove-woocommerce-css', get_template_directory_uri() . '/assets/css/dragoncove-woocommerce.css', array(), '', 'all');
// Comment reply script for threaded comments
if (is_singular() and comments_open() and get_option('thread_comments') == 1) {
wp_enqueue_script('comment-reply');
}
}
示例11: et_vertex_load_scripts_styles
function et_vertex_load_scripts_styles()
{
global $wp_styles;
$template_dir = get_template_directory_uri();
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
wp_enqueue_script('superfish', $template_dir . '/js/superfish.js', array('jquery'), '1.0', true);
wp_enqueue_script('waypoints', $template_dir . '/js/waypoints.min.js', array('jquery'), '1.0', true);
wp_enqueue_script('vertex-custom-script', $template_dir . '/js/custom.js', array('jquery'), '1.0', true);
wp_localize_script('vertex-custom-script', 'et_custom', array('mobile_nav_text' => esc_html__('Navigation Menu', 'Vertex')));
$et_gf_enqueue_fonts = array();
$et_gf_heading_font = sanitize_text_field(et_get_option('heading_font', 'none'));
$et_gf_body_font = sanitize_text_field(et_get_option('body_font', 'none'));
if ('none' != $et_gf_heading_font) {
$et_gf_enqueue_fonts[] = $et_gf_heading_font;
}
if ('none' != $et_gf_body_font) {
$et_gf_enqueue_fonts[] = $et_gf_body_font;
}
if (!empty($et_gf_enqueue_fonts)) {
et_gf_enqueue_fonts($et_gf_enqueue_fonts);
}
/*
* Loads the main stylesheet.
*/
wp_enqueue_style('vertex-style', get_stylesheet_uri());
}
示例12: orbis_subscription_product_render_details
function orbis_subscription_product_render_details()
{
if (is_singular('orbis_subs_product')) {
global $orbis_subscriptions_plugin;
get_template_part('templates/subscription_product_details');
}
}
示例13: reactor_numeric_posts_nav
function reactor_numeric_posts_nav()
{
if (is_singular()) {
return;
}
global $wp_query;
$paginas = new WP_Query($args);
$html = '';
/** Stop execution if there's only 1 page */
if ($paginas->max_num_pages <= 1) {
return;
}
$paged = get_query_var('paged') ? absint(get_query_var('paged')) : 1;
$max = intval($paginas->max_num_pages);
/** Add current page to the array */
if ($paged >= 1) {
$links[] = $paged;
}
/** Add the pages around the current page to the array */
if ($paged >= 3) {
$links[] = $paged - 1;
$links[] = $paged - 2;
}
if ($paged + 2 <= $max) {
$links[] = $paged + 2;
$links[] = $paged + 1;
}
echo '<div class="navigation"><ul>' . "\n";
/** Previous Post Link */
if (get_previous_posts_link()) {
printf('<li>%s</li>' . "\n", get_previous_posts_link());
}
/** Link to first page, plus ellipses if necessary */
if (!in_array(1, $links)) {
$class = 1 == $paged ? ' class="active"' : '';
printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link(1)), '1');
if (!in_array(2, $links)) {
echo '<li>…</li>';
}
}
/** Link to current page, plus 2 pages in either direction if necessary */
sort($links);
foreach ((array) $links as $link) {
$class = $paged == $link ? ' class="active"' : '';
printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link($link)), $link);
}
/** Link to last page, plus ellipses if necessary */
if (!in_array($max, $links)) {
if (!in_array($max - 1, $links)) {
echo '<li>…</li>' . "\n";
}
$class = $paged == $max ? ' class="active"' : '';
printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link($max)), $max);
}
/** Next Post Link */
if (get_next_posts_link()) {
printf('<li>%s</li>' . "\n", get_next_posts_link());
}
echo '</ul></div>' . "\n";
}
示例14: kasa_of_register_js
function kasa_of_register_js()
{
wp_enqueue_script('main', esc_url(get_template_directory_uri() . '/js/main.js'), array('jquery'), '1.0', true);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
示例15: site_scripts
function site_scripts()
{
global $wp_styles;
// Call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
// Load What-Input files in footer
wp_enqueue_script('what-input', get_template_directory_uri() . '/vendor/what-input/what-input.min.js', array(), '', true);
// Adding Foundation scripts file in the footer
wp_enqueue_script('foundation-js', get_template_directory_uri() . '/assets/js/foundation.min.js', array('jquery'), '6.0', true);
// Adding scripts file in the footer
wp_enqueue_script('site-js', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery', 'masonry'), '', true);
// Adding scripts file in the footer
wp_enqueue_script('slick', get_template_directory_uri() . '/assets/js/slick.min.js', array('jquery'), '', true);
// Adding imagesLoaded
wp_enqueue_script('imagesLoaded', get_template_directory_uri() . '/node_modules/imagesloaded/imagesloaded.pkgd.min.js', array('jquery'), '', true);
// Adding Slick Nav
wp_enqueue_script('slicknav', get_template_directory_uri() . '/assets/js/slicknav/dist/jquery.slicknav.min.js', array('jquery'), '', true);
// Smooth Scroll
wp_enqueue_script('smoscroll', get_template_directory_uri() . '/assets/js/jquery.smooth-scroll.min.js', array("jquery"), '3.3.2', true);
// Register main stylesheet
wp_enqueue_style('site-css', get_template_directory_uri() . '/assets/css/style.css', array(), '', 'all');
// Register main stylesheet
wp_enqueue_style('slicknav-css', get_template_directory_uri() . '/assets/css/slicknav.css', array(), '', 'all');
// Register Foundation Icons
wp_enqueue_style('icons', get_template_directory_uri() . '/assets/css/social_foundicons.css', array(), '', 'all');
wp_enqueue_style('iconsie7', get_template_directory_uri() . '/assets/css/social_foundicons_ie7.css', array(), '', 'all');
// Comment reply script for threaded comments
if (is_singular() and comments_open() and get_option('thread_comments') == 1) {
wp_enqueue_script('comment-reply');
}
}