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

PHP is_singular函数代码示例

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

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



在下文中一共展示了is_singular函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
     }
 }
开发者ID:nhatnam1102,项目名称:wp-content,代码行数:29,代码来源:blog-exclude-categories.php


示例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');
    }
}
开发者ID:joffcrabtree,项目名称:wp-orbis-subscriptions,代码行数:10,代码来源:template.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;
 }
开发者ID:rvelezc,项目名称:drpelaezgo.com,代码行数:39,代码来源:class-avada-dynamic-css.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: 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);
    }
}
开发者ID:derk153,项目名称:diamescort,代码行数:33,代码来源:enqueue.php


示例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');
    }
}
开发者ID:adeka,项目名称:BraftonTheme,代码行数:10,代码来源:theme-functions.php


示例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;
     }
 }
开发者ID:envickery,项目名称:staging.xylemwatermark.org,代码行数:29,代码来源:language-switcher.php


示例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');
    }
}
开发者ID:ranchodeluxemedia,项目名称:studiobase,代码行数:32,代码来源:scripts.php


示例9: javo_lister_redirect_disabled

function javo_lister_redirect_disabled($redirect_url)
{
    if (is_singular('lister')) {
        $redirect_url = false;
    }
    return $redirect_url;
}
开发者ID:redcypress,项目名称:lacecake,代码行数:7,代码来源:define.php


示例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');
    }
}
开发者ID:KadenLag,项目名称:dragon_cove_base,代码行数:25,代码来源:enqueue-scripts.php


示例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());
}
开发者ID:iinspiration,项目名称:theme,代码行数:28,代码来源:functions.php


示例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');
    }
}
开发者ID:joffcrabtree,项目名称:wt-orbis,代码行数:7,代码来源:subscriptions.php


示例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";
}
开发者ID:jairoburbano,项目名称:grunt-wordpress,代码行数:60,代码来源:theme-helpers.php


示例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');
     }
 }
开发者ID:ReConcepts,项目名称:mashariki,代码行数:7,代码来源:functions.php


示例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');
    }
}
开发者ID:stevelolz,项目名称:dean,代码行数:30,代码来源:enqueue-scripts.php


示例16: generate_slideshow

 /**
  * Generate the HTML for this slideshow.
  * @since  1.0.0
  * @return string The generated HTML.
  */
 protected function generate_slideshow($instance)
 {
     if (!is_singular()) {
         return '';
     }
     global $wooslider;
     $settings = $wooslider->settings->get_settings();
     $settings['slider_type'] = $this->slider_type;
     $extra_args = array();
     foreach ($instance as $k => $v) {
         if (!in_array($k, array_keys($settings))) {
             $extra_args[$k] = esc_attr($v);
             unset($instance[$k]);
         }
     }
     // Make sure the various settings are applied.
     if (isset($instance['show_advanced_settings']) && $instance['show_advanced_settings'] == true) {
         foreach ($settings as $k => $v) {
             if (isset($instance[$k]) && $instance[$k] != $settings[$k]) {
                 $settings[$k] = esc_attr($instance[$k]);
             }
         }
     }
     $html = wooslider($settings, $extra_args, false);
     return $html;
 }
开发者ID:bulats,项目名称:chef,代码行数:31,代码来源:widget-wooslider-attachments.php


示例17: widget

 public function widget($args, $instance)
 {
     if (!is_singular()) {
         return;
     }
     $the_id = get_the_ID();
     if (!comments_open($the_id)) {
         return;
     } else {
         $html = $args['before_widget'];
         if (!empty($instance['title'])) {
             $html .= $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
         }
         $api_url = esc_url(home_url('/')) . 'wp-json/wp/v2/comments';
         $author = __('NAME:', 'rest-api-widgets');
         $mailaddress = __('MAIL:', 'rest-api-widgets');
         $content = __('COMMENTS:', 'rest-api-widgets');
         $send_btn = __('SEND', 'rest-api-widgets');
         $success_text = __('Success! Reload now.', 'rest-api-widgets');
         $fail_text = __('Fail :(', 'rest-api-widgets');
         $html .= "<form action={$api_url} method='post' id='rest-api-widgets-comment'>";
         $html .= '<dl>';
         $html .= "<dt>{$author}</dt><dd><input name='author_name' value=''></dd>";
         $html .= "<dt>{$mailaddress}</dt><dd><input name='author_email' value=''></dd>";
         $html .= "<dt>{$content}</dt><dd><textarea name='content' id=' cols='30' rows='10'></textarea></dd>";
         $html .= '</dl>';
         $html .= "<input type='hidden' name='post' value='{$the_id}'>";
         $html .= "<input type='hidden' name='success_text' value='{$success_text}'>";
         $html .= "<input type='hidden' name='fail_text' value='{$fail_text}'>";
         $html .= "<button>{$send_btn}</button>";
         $html .= '</form>';
     }
     echo $html . $args['after_widget'];
 }
开发者ID:hideokamoto,项目名称:rest-api-widget,代码行数:34,代码来源:class.commentform.php


示例18: condition

 function condition()
 {
     if (apply_filters('appthemes_disable_order_summary_template', false)) {
         return false;
     }
     return is_singular(APPTHEMES_ORDER_PTYPE);
 }
开发者ID:TopLineMediaTeam,项目名称:horseshow,代码行数:7,代码来源:order-templates.php


示例19: widget

 function widget($args, $instance)
 {
     global $wp_query;
     extract($args);
     $current_taxonomy = $this->_get_current_taxonomy($instance);
     if (!empty($instance['title'])) {
         $title = $instance['title'];
     } else {
         if ('post_tag' == $current_taxonomy) {
             $title = __('Tags');
         } else {
             $tax = get_taxonomy($current_taxonomy);
             $title = $tax->labels->name;
         }
     }
     $use_desc_for_title = isset($instance['use_desc_for_title']) ? $instance['use_desc_for_title'] : true;
     $count = isset($instance['count']) ? $instance['count'] : false;
     $title = apply_filters('widget_title', $title, $instance, $this->id_base);
     $current_term = false;
     $current_term_id = $current_post_id = 0;
     if (suwp::is_tax($current_taxonomy)) {
         $current_term = $wp_query->get_queried_object();
         $current_term_id = $wp_query->get_queried_object_id();
         $title = $current_term->name;
     } elseif (is_singular()) {
         $current_post_id = $wp_query->get_queried_object_id();
         $post_terms = get_the_terms($current_post_id, $current_taxonomy);
         if (is_array($post_terms) && count($post_terms)) {
             $current_term = reset($post_terms);
             $current_term_id = $current_term->term_id;
             $title = $current_term->name;
         }
     }
     $term_args = array('taxonomy' => $current_taxonomy, 'orderby' => 'name', 'show_count' => $count ? '1' : '0', 'hierarchical' => '0', 'title_li' => '', 'parent' => $current_term_id, 'show_option_none' => false, 'use_desc_for_title' => $use_desc_for_title ? '1' : '0', 'echo' => false);
     $category_output = $post_output = '';
     if (!$current_term || is_taxonomy_hierarchical($current_taxonomy)) {
         $category_output = wp_list_categories($term_args);
     }
     if ($current_term) {
         $child_posts = get_posts(array('taxonomy' => $current_taxonomy, 'term' => $current_term->slug, 'numberposts' => 5));
         foreach ($child_posts as $child_post) {
             $css_class = '';
             if ($child_post->ID == $current_post_id) {
                 $css_class = 'current_post_item';
             }
             $post_output .= "\n\t\t\t<li class=\"" . $css_class . '"><a href="' . get_permalink($child_post->ID) . '" title="' . esc_attr(wp_strip_all_tags(apply_filters('the_title', $child_post->post_title, $child_post->ID))) . '">' . apply_filters('the_title', $child_post->post_title, $child_post->ID) . "</a></li>\n";
         }
     }
     if ($category_output || $post_output) {
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         echo "\n\t\t<ul>\n";
         echo $category_output;
         echo $post_output;
         echo "\n\t\t</ul>\n";
         echo $after_widget;
     }
 }
开发者ID:grantschulte,项目名称:suna-wordpress,代码行数:60,代码来源:widgets.php


示例20: filter_content

 public function filter_content($content)
 {
     // Get Templates
     $templates = self::get_option('rwp_templates');
     $terms = wp_get_object_terms(get_the_ID(), array_keys(get_taxonomies()));
     $terms_keys = array();
     foreach ($terms as $term) {
         $terms_keys[$term->taxonomy][] = $term->term_id;
     }
     //self::pretty_print( $terms_keys );
     foreach ($templates as $template) {
         if (isset($template['template_auto_reviews']) && !empty($template['template_auto_reviews'])) {
             if (is_singular($template['template_auto_reviews']) && is_main_query()) {
                 if (isset($template['template_exclude_terms'])) {
                     $to_exclude = false;
                     foreach ($template['template_exclude_terms'] as $id) {
                         $i = explode('-', $id);
                         if (in_array($i[1], $terms_keys[$i[0]])) {
                             $to_exclude = true;
                             break;
                         }
                     }
                     if ($to_exclude) {
                         continue;
                     }
                 }
                 $new_content = '[rwp-review id="-1" template="' . $template['template_id'] . '"]';
                 $content .= $new_content;
             }
         }
     }
     return $content;
 }
开发者ID:jprdev,项目名称:S.J-Enterprise,代码行数:33,代码来源:class-reviewer.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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