Advertisement
Guest User

functions

a guest
Oct 14th, 2011
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.70 KB | None | 0 0
  1. <?php
  2. class My_Walker_Page extends Walker {
  3.     var $tree_type = 'page';
  4.  
  5.     var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
  6.  
  7.     function start_lvl(&$output, $depth) {
  8.         $indent = str_repeat("\t", $depth);
  9.         switch ($depth) {
  10.             case 0:
  11.                 $output .= $indent."<ul id=\"drop_nav\">\n";
  12.                 break;
  13.             case 1:
  14.                 $output .= "<div class=\"subnav\">\n";
  15.                 $output .= "<div class=\"subnavTop\">\n";
  16.                 $output .= $indent."<ul class='subnavContent'>\n";
  17.                 $output .= "<li>\n<dl>\n";
  18.                 break;
  19.             default:
  20.                 break;
  21.         }
  22.     }
  23.  
  24.     function end_lvl(&$output, $depth) {
  25.         $indent = str_repeat("\t", $depth);
  26.         switch ($depth) {
  27.             case 0:
  28.                 $output .= "\n".$indent."</ul>\n";
  29.                 break;
  30.             case 1:
  31.                 $output .= "\n</dl>\n</li>\n";
  32.                 $output .= "</div>\n";
  33.                 $output .= "</div>\n";
  34.                 $output .= "</div>\n";
  35.                 break;
  36.             default:
  37.                 break;
  38.         }
  39.     }
  40.  
  41.     function start_el(&$output, $page, $depth, $args, $current_page) {
  42.         if ( $depth )
  43.             $indent = str_repeat("\t", $depth);
  44.         else
  45.             $indent = '';
  46.  
  47.         extract($args, EXTR_SKIP);
  48.         $css_class = array('page_item', 'page-item-'.$page->ID);
  49.         if ( !empty($current_page) ) {
  50.             $_current_page = get_page( $current_page );
  51.             _get_post_ancestors($_current_page);
  52.             if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) )
  53.                 $css_class[] = 'current_page_ancestor';
  54.             if ( $page->ID == $current_page )
  55.                 $css_class[] = 'current_page_item';
  56.             elseif ( $_current_page && $page->ID == $_current_page->post_parent )
  57.                 $css_class[] = 'current_page_parent';
  58.         } elseif ( $page->ID == get_option('page_for_posts') ) {
  59.             $css_class[] = 'current_page_parent';
  60.         }
  61.  
  62.         $css_class = implode(' ', apply_filters('page_css_class', $css_class, $page));
  63.  
  64.         $page_link1 = '<a href="" img="' . get_image("imagem_de_fundo",1,1,0,$page->ID) . '" img01="' . get_image("imagem_01",1,1,0,$page->ID) . '" img02="' . get_image("imagem_02",1,1,0,$page->ID) . '" class="thumbnail" onClick="showHide1(' . "'" . get_the_title($page->ID) . "'" . ')" title="' . esc_attr( wp_strip_all_tags( apply_filters( 'the_title', $page->post_title, $page->ID ) ) ) . "; " . addContent('texto_01', get("texto_01",1,1,1,$page->ID) ) . '">' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>';
  65.         $page_link2 = '<a href="" img="' . get_image("imagem_de_fundo",1,1,0,$page->ID) . '" img01="' . get_image("imagem_01",1,1,0,$page->ID) . '" img02="' . get_image("imagem_02",1,1,0,$page->ID) . '" class="thumbnail" onClick="showHide2(' . "'" . get_the_title($page->ID) . "'" . ')" title="' . esc_attr( wp_strip_all_tags( apply_filters( 'the_title', $page->post_title, $page->ID ) ) ) . "; " . addContent('texto_01', get("texto_01",1,1,1,$page->ID) ) . '">' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>';
  66.         $page_link3 = '<a href="" img="' . get_image("imagem_de_fundo",1,1,0,$page->ID) . '" img01="' . get_image("imagem_01",1,1,0,$page->ID) . '" img02="' . get_image("imagem_02",1,1,0,$page->ID) . '" class="thumbnail" onClick="showHide3(' . "'" . get_the_title($page->ID) . "'" . ')" title="' . esc_attr( wp_strip_all_tags( apply_filters( 'the_title', $page->post_title, $page->ID ) ) ) . "; " . addContent('texto_01', get("texto_01",1,1,1,$page->ID) ) . '">' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>';
  67.         switch ($depth) {
  68.             case 0:
  69.                 $output .= $indent . '<li class="' . $css_class . '">'.$page_link1. '<div id="' . get_the_title($page->ID) . '" style="display:none;">';
  70.                 $output .= $indent . '<div class="textoexp">' . get('texto_exp',1,1,1,$page->ID) . '';
  71.                 if ( get('imprensapdf',1,1,1,$page->ID,TRUE) )
  72.                 $output .= '<div class="imprensadownloads">' . '<a href="' . get('imprensapdf',1,1,1,$page->ID) . '" target="_blank">Descarregar Artigo</a></div>';
  73.                 else
  74.                 $output .= "";
  75.                 if ( get('imprensadoc',1,1,1,$page->ID,TRUE) )
  76.                 $output .= '<div class="imprensadownloads">' . '<a href="' . get('imprensadoc',1,1,1,$page->ID) . '" target="_blank">Descarregar Texto</a></div>';
  77.                 else
  78.                 $output .= "";
  79.                 $output .= "</div>";
  80.                 break;
  81.             case 1:
  82.                 $output .= $indent . '<dt class="' . $css_class . '">' .$page_link2. '<div id="' . get_the_title($page->ID) . '" style="display:none;">';
  83.                 $output .= $indent . '<div class="textoexp">' . get('texto_exp',1,1,1,$page->ID) . '';
  84.                 if ( get('imprensapdf',1,1,1,$page->ID,TRUE) )
  85.                 $output .= '<div class="imprensadownloads">' . '<a href="' . get('imprensapdf',1,1,1,$page->ID) . '" target="_blank">Descarregar Artigo</a></div>';
  86.                 else
  87.                 $output .= "";
  88.                 if ( get('imprensadoc',1,1,1,$page->ID,TRUE) )
  89.                 $output .= '<div class="imprensadownloads">' . '<a href="' . get('imprensadoc',1,1,1,$page->ID) . '" target="_blank">Descarregar Texto</a></div>';
  90.                 else
  91.                 $output .= "";
  92.                 $output .= "</div>";
  93.                 break;
  94.             default:
  95.                 $output .= $indent . '<dd class="' . $css_class . '">'.$page_link3. '<div id="' . get_the_title($page->ID) . '" style="display:none;">';
  96.                 $output .= $indent . '<div class="textoexp">' . get('texto_exp',1,1,1,$page->ID) . '';
  97.                 if ( get('imprensapdf',1,1,1,$page->ID,TRUE) )
  98.                 $output .= '<div class="imprensadownloads">' . '<a href="' . get('imprensapdf',1,1,1,$page->ID) . '" target="_blank">Descarregar Artigo</a></div>';
  99.                 else
  100.                 $output .= "";
  101.                 if ( get('imprensadoc',1,1,1,$page->ID,TRUE) )
  102.                 $output .= '<div class="imprensadownloads">' . '<a href="' . get('imprensadoc',1,1,1,$page->ID) . '" target="_blank">Descarregar Texto</a></div>';
  103.                 else
  104.                 $output .= "";
  105.                 $output .= "</div>";
  106.                 break;
  107.         }
  108.  
  109.         if ( !empty($show_date) ) {
  110.             if ( 'modified' == $show_date )
  111.                 $time = $page->post_modified;
  112.             else
  113.                 $time = $page->post_date;
  114.  
  115.             $output .= " " . mysql2date($date_format, $time);
  116.         }
  117.     }
  118.  
  119.     function end_el(&$output, $page, $depth) {
  120.         switch ($depth) {
  121.             case 0:
  122.                 $output .= "</li>\n";
  123.                 break;
  124.             case 1:
  125.                 $output .= "</dt>\n";
  126.                 break;
  127.             default:
  128.                 $output .= "</dd>\n";
  129.                 break;
  130.         }
  131.     }
  132. }
  133.  
  134. ?>
  135. <?php
  136. function mytheme_comment($comment, $args, $depth) {
  137. $GLOBALS['comment'] = $comment; ?>
  138. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
  139. <div id="comment-<?php comment_ID(); ?>">
  140. <?php if ($comment->comment_approved == '0') : ?>
  141. <?php _e('(O seu comentario aguarda moderacao.)') ?>
  142. <br />
  143. <?php endif; ?>
  144. <div class="comment-author vcard">
  145. <?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?></br>
  146. <b><?php printf(__('Escrito por %s'), get_comment_author_link()) ?></b>
  147. </div>
  148. <div class="comment-meta commentmetadata"><?php edit_comment_link(__('(Edit)'),' ','') ?></div>
  149. <?php comment_text() ?>
  150. <div class="reply">
  151. <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  152. </div>
  153. </div>
  154. <?php
  155. }
  156. ?>
  157.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement