XPressME Integration Kit

Trac

source: trunk/include/xpress_breadcrumbs.php @ 59

Last change on this file since 59 was 59, checked in by toemon, 15 years ago

PEAKさんが提案されている、統一的なパンくず規格 xoops_breadcrumbs の提案p?page=article&storyid=404への対応 #51

File size: 2.0 KB
Line 
1<?php
2//      $xoops_breadcrumbs[0] = array( 'name' => get_bloginfo('description') , 'url' => get_settings('home'));
3        $xoops_breadcrumbs[0] = array( 'name' => get_bloginfo('name') , 'url' => get_settings('home'));
4        $pagetitle='';
5        if (is_category()) {
6                        $this_cat = get_category($cat);
7                        $p_count = 0;
8                        while ($this_cat->parent) {                     
9                                $this_cat = get_category($this_cat->parent);
10                                $cat_parrent[$p_count] = array( 'name' => $this_cat->cat_name , 'url' => get_category_link($this_cat->cat_ID));
11                                $p_count++;
12                        }
13                        for ($i = 1 ; $i <= $p_count ;$i++){
14                                        $xoops_breadcrumbs[$i] = $cat_parrent[$p_count - $i];
15                        }
16                        $xoops_breadcrumbs[$p_count+1] = array( 'name' => single_cat_title('', false));
17        } elseif (is_day()) {
18                        $xoops_breadcrumbs[1] = array( 'name' => get_the_time(__('F j, Y')));
19        } elseif (is_month()) {
20                        $xoops_breadcrumbs[1] = array( 'name' => get_the_time(__('F, Y')));
21        } elseif (is_year()) {
22                        $xoops_breadcrumbs[1] = array( 'name' => get_the_time('Y'));
23        } elseif (is_author()) {
24                        $xoops_breadcrumbs[1] = array( 'name' => get_author_name( get_query_var('author') ));
25        } elseif (is_single()) {
26                        $xoops_breadcrumbs[1] = array( 'name' => single_post_title('', false));
27        } elseif (is_page()) {
28                        $now_page = get_page($page_id);
29                        $this_page = $now_page;
30                        $p_count = 0;
31                        while ($this_page->post_parent) {                       
32                                $this_page = get_page($this_page->post_parent);
33
34                                $page_parrent[$p_count] = array( 'name' => $this_page->post_title , 'url' => get_permalink($this_page->ID));
35                                $p_count++;
36                        }
37                        for ($i = 1 ; $i <= $p_count ;$i++){
38                                        $xoops_breadcrumbs[$i] = $page_parrent[$p_count - $i];
39                        }
40                        $xoops_breadcrumbs[$p_count+1] = array( 'name' => $now_page->post_title);
41        } elseif (is_search()){
42                        $xoops_breadcrumbs[1] = array( 'name' => $pagetitle);
43        } elseif(function_exists( 'is_tag' )){
44                if(is_tag() ) {
45                        $xoops_breadcrumbs[1] = array( 'name' => single_tag_title('', false));
46                }
47        }
48        $xoopsTpl->assign('xoops_breadcrumbs', $xoops_breadcrumbs);
49?>
Note: See TracBrowser for help on using the repository browser.