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


PHP WPBakeryShortCode::getExtraClass方法代码示例

本文整理汇总了PHP中WPBakeryShortCode::getExtraClass方法的典型用法代码示例。如果您正苦于以下问题:PHP WPBakeryShortCode::getExtraClass方法的具体用法?PHP WPBakeryShortCode::getExtraClass怎么用?PHP WPBakeryShortCode::getExtraClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WPBakeryShortCode的用法示例。


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

示例1: etheme_teaser

    function etheme_teaser($atts, $content = null)
    {
        $title = $grid_columns_count = $grid_teasers_count = $grid_layout = $grid_link = $grid_link_target = $pagination = '';
        $grid_template = $grid_thumb_size = $grid_posttypes = $grid_taxomonies = $grid_categories = $posts_in = $posts_not_in = '';
        $grid_content = $el_class = $width = $orderby = $order = $el_position = $isotope_item = $isotope_class = $posted_by = $posted_block = $hover_mask = $border = '';
        extract(shortcode_atts(array('title' => '', 'grid_columns_count' => 4, 'grid_teasers_count' => 8, 'grid_layout' => 'title_thumbnail_text', 'grid_link' => 'link_post', 'grid_link_target' => '_self', 'grid_template' => 'grid', 'grid_thumb_size' => '500x300', 'grid_posttypes' => '', 'border' => 'on', 'pagination' => 'show', 'posted_block' => 'show', 'hover_mask' => 'show', 'grid_taxomonies' => '', 'grid_categories' => '', 'posts_in' => '', 'posts_not_in' => '', 'grid_content' => 'teaser', 'el_class' => '', 'width' => '1/1', 'orderby' => NULL, 'order' => 'DESC', 'el_position' => ''), $atts));
        if ($grid_template == 'grid' || $grid_template == 'filtered_grid') {
            $isotope_item = 'et_isotope-item ';
        } else {
            if ($grid_template == 'carousel') {
                $isotope_item = '';
            }
        }
        $output = '';
        $el_class = WPBakeryShortCode::getExtraClass($el_class);
        $width = '';
        //wpb_translateColumnWidthToSpan( $width );
        $col = 12 / $grid_columns_count;
        $li_span_class = 'col-lg-' . $col;
        $query_args = array();
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        if (is_front_page()) {
            $paged = get_query_var('page') ? get_query_var('page') : 1;
        }
        $query_args['paged'] = $paged;
        $not_in = array();
        if ($posts_not_in != '') {
            $posts_not_in = str_ireplace(" ", "", $posts_not_in);
            $not_in = explode(",", $posts_not_in);
        }
        $link_target = $grid_link_target == '_blank' ? ' target="_blank"' : '';
        //exclude current post/page from query
        if ($posts_in == '') {
            global $post;
            array_push($not_in, $post->ID);
        } else {
            if ($posts_in != '') {
                $posts_in = str_ireplace(" ", "", $posts_in);
                $query_args['post__in'] = explode(",", $posts_in);
            }
        }
        if ($posts_in == '' || $posts_not_in != '') {
            $query_args['post__not_in'] = $not_in;
        }
        // Post teasers count
        if ($grid_teasers_count != '' && !is_numeric($grid_teasers_count)) {
            $grid_teasers_count = -1;
        }
        if ($grid_teasers_count != '' && is_numeric($grid_teasers_count)) {
            $query_args['posts_per_page'] = $grid_teasers_count;
        }
        // Post types
        $pt = array();
        if ($grid_posttypes != '') {
            $grid_posttypes = explode(",", $grid_posttypes);
            foreach ($grid_posttypes as $post_type) {
                array_push($pt, $post_type);
            }
            $query_args['post_type'] = $pt;
        }
        // Taxonomies
        $taxonomies = array();
        if ($grid_taxomonies != '') {
            $grid_taxomonies = explode(",", $grid_taxomonies);
            foreach ($grid_taxomonies as $taxom) {
                array_push($taxonomies, $taxom);
            }
        }
        // Narrow by categories
        if ($grid_categories != '') {
            $grid_categories = explode(",", $grid_categories);
            $gc = array();
            foreach ($grid_categories as $grid_cat) {
                array_push($gc, $grid_cat);
            }
            $gc = implode(",", $gc);
            ////http://snipplr.com/view/17434/wordpress-get-category-slug/
            $query_args['category_name'] = $gc;
            $taxonomies = get_taxonomies('', 'object');
            $query_args['tax_query'] = array('relation' => 'OR');
            foreach ($taxonomies as $t) {
                if (in_array($t->object_type[0], $pt)) {
                    $query_args['tax_query'][] = array('taxonomy' => $t->name, 'terms' => $grid_categories, 'field' => 'slug');
                }
            }
        }
        // Order posts
        if ($orderby != NULL) {
            $query_args['orderby'] = $orderby;
        }
        $query_args['order'] = $order;
        // Run query
        $my_query = new WP_Query($query_args);
        //global $_wp_additional_image_sizes;
        $teasers = '';
        $teaser_categories = array();
        if ($grid_template == 'filtered_grid' && empty($grid_taxomonies)) {
            $taxonomies = get_object_taxonomies(!empty($query_args['post_type']) ? $query_args['post_type'] : get_post_types(array('public' => false, 'name' => 'attachment'), 'names', 'NOT'));
        }
        if ($posted_block == 'show') {
//.........这里部分代码省略.........
开发者ID:EmmaTope,项目名称:gadafunds,代码行数:101,代码来源:theme-functions.php


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