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