XPressME Integration Kit

Trac

source: tags/Ver2.2.0RC1/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/category_block_theme.php @ 450

Last change on this file since 450 was 450, checked in by toemon, 14 years ago

Ver2.2.0RC1 リリース

File size: 2.4 KB
Line 
1<?php
2// Block Version: 1.0
3function category_block($options)
4{
5        $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
6        $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_block_category.html' : trim( $options[1] );
7        $show_option_all = empty( $options[2] ) ? '' : $options[2] ;
8        $orderby = empty( $options[3] ) ? 'name' : $options[3] ;
9        $order = empty( $options[4] ) ? 'ASC' : $options[4] ;
10        $show_last_updated = empty( $options[5] ) ? false : true ;
11        $show_count = empty( $options[6] ) ? false : true ;
12        $hide_empty = empty( $options[7] ) ? false : true ;
13        $use_desc_for_title = empty( $options[8] ) ? false : true ;
14        $exclude = empty( $options[9] ) ? '' : $options[9] ;
15        $includes = empty( $options[10] ) ? '' : $options[10] ;
16        $hierarchical = empty( $options[11] ) ? false : true ;
17        $depth  = !is_numeric( $options[12] ) ? 0 : $options[12] ;
18       
19        if (function_exists('wp_list_categories')){
20                $param = array(
21                        'show_option_all' => $show_option_all,
22                        'orderby' => $orderby,
23                        'order' => $order,
24                        'show_last_update' => $show_last_updated,
25                        'style' => 'list',
26                        'show_count' => $show_count,
27                        'hide_empty' => $hide_empty,
28                        'use_desc_for_title' => $use_desc_for_title,
29                        'child_of' => 0,
30                        'feed' => '',
31                        'feed_image' => '',
32                        'exclude' => $exclude,
33                        'include' => $includes,
34                        'hierarchical' => $hierarchical,
35                        'title_li' => '',
36                        'number' => '',
37                        'echo' => 0,
38                        'depth' => $depth
39                );
40                if ( xpress_is_wp_version('>=','2.3') ) {
41                        $block['categories'] = wp_list_categories($param);
42                } else {        // not suport echo flag
43                        ob_start();
44                        wp_list_categories($param);
45                        $block['categories'] = ob_get_contents();
46                        ob_end_clean();
47                }
48        } else {
49                if (empty($show_option_all))
50                        $optionall = 0;
51                else
52                        $optionall = 1;
53                $param = array(
54                        'optionall' => $optionall,
55                        'all' => $show_option_all,
56                        'sort_column' => $orderby,
57                        'sort_order' => $order,
58                        'show_last_update' => $show_last_updated,
59                        'optioncount' => $show_count,
60                        'hide_empty' => $hide_empty,
61                        'use_desc_for_title' => $use_desc_for_title,
62                        'child_of' => 0,
63                        'feed' => '',
64                        'feed_image' => '',
65                        'exclude' => $exclude,
66                        'hierarchical' => $hierarchical,
67                        'recurse' => 1,
68                );
69                ob_start();
70                        wp_list_cats($param);
71                        $block['categories'] = ob_get_contents();
72                ob_end_clean();
73        }
74        return $block ;
75}
76
77?>
Note: See TracBrowser for help on using the repository browser.