SHOW:
|
|
- or go back to the newest paste.
| 1 | class My_Page_Walker extends Walker_Page {
| |
| 2 | ||
| 3 | function start_el(&$output, $page, $depth, $args, $current_page) {
| |
| 4 | if ( $depth ) | |
| 5 | $indent = str_repeat("\t", $depth);
| |
| 6 | else | |
| 7 | $indent = ''; | |
| 8 | ||
| 9 | extract($args, EXTR_SKIP); | |
| 10 | $css_class = array('page_item', 'page-item-'.$page->ID);
| |
| 11 | if ( !empty($current_page) ) {
| |
| 12 | $_current_page = get_page( $current_page ); | |
| 13 | _get_post_ancestors($_current_page); | |
| 14 | if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) ) | |
| 15 | $css_class[] = 'current_page_ancestor'; | |
| 16 | if ( $page->ID == $current_page ) | |
| 17 | $css_class[] = 'current_page_item'; | |
| 18 | elseif ( $_current_page && $page->ID == $_current_page->post_parent ) | |
| 19 | $css_class[] = 'current_page_parent'; | |
| 20 | } elseif ( $page->ID == get_option('page_for_posts') ) {
| |
| 21 | $css_class[] = 'current_page_parent'; | |
| 22 | } | |
| 23 | ||
| 24 | $css_class = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) ); | |
| 25 | ||
| 26 | $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_permalink($page->ID) . '">' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>'; | |
| 27 | - | if($page->ID == 39){ // put the portfolio archive link behind this Page
|
| 27 | + | |
| 28 | $portfolio_archive_link = get_post_meta($page->ID, 'portfolio archive', true); | |
| 29 | ||
| 30 | if($portfolio_archive_link != ''){ // put the portfolio archive behind this Page
| |
| 31 | global $wp_query; | |
| 32 | ||
| 33 | - | else |
| 33 | + | |
| 34 | - | $css_class = 'page_item'; |
| 34 | + | |
| 35 | $css_class = 'page_item current_page_item'; | |
| 36 | - | $output .= '</li><li class="' . $css_class . '"><a href="/portfolio">' . $link_before . 'Portfolio' . $link_after . '</a>'; |
| 36 | + | } else {
|
| 37 | $css_class = 'page_item'; | |
| 38 | } | |
| 39 | $output .= '</li>'."\n".$indent .'<li class="' . $css_class . '"><a href="/portfolio">' . $link_before . 'Portfolio' . $link_after . '</a>'; | |
| 40 | ||
| 41 | } | |
| 42 | ||
| 43 | ||
| 44 | if ( !empty($show_date) ) {
| |
| 45 | if ( 'modified' == $show_date ) | |
| 46 | $time = $page->post_modified; | |
| 47 | else | |
| 48 | $time = $page->post_date; | |
| 49 | ||
| 50 | $output .= " " . mysql2date($date_format, $time); | |
| 51 | } | |
| 52 | } | |
| 53 | ||
| 54 | } |