Реклама на сайте Advertise with us

WP и фаил темы functions.php

Расширенный поиск по форуму
 
Новая тема Новая тема   
Автор
Поиск в теме:

Z

С нами с 15.05.05
Сообщения: 54379
Рейтинг: 7770


Передовик Master-X (16.10.2007) Передовик Master-X (16.12.2010) Передовик Master-X (01.02.2015) Передовик Master-X (16.05.2015) Передовик Master-X (01.06.2015) Ветеран трепа Master-X (16.06.2015)
Ссылка на сообщениеДобавлено: 15/10/07 в 00:08       Ответить с цитатойцитата 

есть тема, там над сидебарами стоит картинка и текст, решил это поменять перебрал файлы темы header, index, sidebar - неаншел потом доперло что это лежит в functions.php
полез смотрю код
Код:

<?php
// check functions
  if ( function_exists('wp_list_bookmarks') ) //used to check WP 2.1 or not
    $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type='post' and post_status = 'publish'");
   else
    $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
  if (0 < $numposts) $numposts = number_format($numposts);
   $numcmnts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
      if (0 < $numcmnts) $numcmnts = number_format($numcmnts);
// ----------------

function j_ShowAbout() { ?>
<li class="about">
<img src="<?php bloginfo('stylesheet_directory');?>/images/you.jpg" alt="You Avatar" id="avatr"  /><br />
<span><?php $userdata = get_userdata(1); ?><?php if ($userdata->description != '') { ?>
<?php _e($userdata->description); ?></p><?php } else { ?>Blablablablabla<?php } ?>
</span>
  </li>
<?php }   function j_ShowRecentPosts() {?>


но так как знания php стремятся к нулю, вопрос накакой хер этот код нужен, что он делает и для чего
спасибо

andreich дарит вам акцию до 1 000р
КАТАЛОГ ПАРТНЕРОК | Бурж Гембла – тут! | RU Датинг на подписках

0
 

Снимаю. Порчу.

С нами с 25.12.99
Сообщения: 1234
Рейтинг: 786

Ссылка на сообщениеДобавлено: 15/10/07 в 01:55       Ответить с цитатойцитата 

конкретно функция j_ShowAbout() выводит аватар и информацию о пользователе, если хочешь что бы этого не было, то убери упоминание о функции j_ShowAbout() в сайдбаре

Свободу Анжеле Дэвис!

0
 

Z

С нами с 15.05.05
Сообщения: 54379
Рейтинг: 7770


Передовик Master-X (16.10.2007) Передовик Master-X (16.12.2010) Передовик Master-X (01.02.2015) Передовик Master-X (16.05.2015) Передовик Master-X (01.06.2015) Ветеран трепа Master-X (16.06.2015)
Ссылка на сообщениеДобавлено: 15/10/07 в 15:18       Ответить с цитатойцитата 

а вот в header.php нашел код, в самом начале

Код:
<?php

if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '<h2>',
        'after_title' => '</h2>',
    ));

function wp_list_page($args = '') {
   parse_str($args, $r);
   if ( !isset($r['depth']) )
      $r['depth'] = 0;
   if ( !isset($r['show_date']) )
      $r['show_date'] = '';
   if ( !isset($r['child_of']) )
      $r['child_of'] = 0;
   if ( !isset($r['title_li']) )
      $r['title_li'] = __('Pages');
   if ( !isset($r['echo']) )
      $r['echo'] = 1;

   $output = '';

   // Query pages.
   $pages = & get_pages($args);
   if ( $pages ) {

      if ( $r['title_li'] )
         $output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';

      // Now loop over all pages that were selected
      $page_tree = Array();
      foreach ( $pages as $page ) {
         // set the title for the current page
         $page_tree[$page->ID]['title'] = $page->post_title;
         $page_tree[$page->ID]['name'] = $page->post_name;

         // set the selected date for the current page
         // depending on the query arguments this is either
         // the createtion date or the modification date
         // as a unix timestamp. It will also always be in the
         // ts field.
         if ( !empty($r['show_date']) ) {
            if ( 'modified' == $r['show_date'] )
               $page_tree[$page->ID]['ts'] = $page->post_modified;
            else
               $page_tree[$page->ID]['ts'] = $page->post_date;
         }

         // The tricky bit!!
         // Using the parent ID of the current page as the
         // array index we set the curent page as a child of that page.
         // We can now start looping over the $page_tree array
         // with any ID which will output the page links from that ID downwards.
         if ( $page->post_parent != $page->ID)
            $page_tree[$page->post_parent]['children'][] = $page->ID;
      }
      // Output of the pages starting with child_of as the root ID.
      // child_of defaults to 0 if not supplied in the query.
      $output .= _page_level_out1($r['child_of'],$page_tree, $r, 0, false);
      if ( $r['title_li'] )
         $output .= '</ul></li>';
   }

   $output = apply_filters('wp_list_page', $output);

   if ( $r['echo'] )
      echo $output;
   else
      return $output;
}


function _page_level_out1($parent, $page_tree, $args, $depth = 0, $echo = true) {
   global $wp_query;
   $queried_obj = $wp_query->get_queried_object();
   $output = '';

   if ( $depth )
      $indent = str_repeat("\t", $depth);
      //$indent = join('', array_fill(0,$depth,"\t"));

   if ( !is_array($page_tree[$parent]['children']) )
      return false;

   foreach ( $page_tree[$parent]['children'] as $page_id ) {
      $cur_page = $page_tree[$page_id];
      $title = $cur_page['title'];

      $css_class = 'page_item';
      if ( $page_id == $queried_obj->ID )
         $css_class .= ' current_page_item';

      $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page_id) . '" title="' . wp_specialchars($title) . '"><span>' . $title . '</span></a>';

      if ( isset($cur_page['ts']) ) {
         $format = get_settings('date_format');
         if ( isset($args['date_format']) )
            $format = $args['date_format'];
         $output .= " " . mysql2date($format, $cur_page['ts']);
      }

      if ( isset($cur_page['children']) && is_array($cur_page['children']) ) {
         $new_depth = $depth + 1;

         if ( !$args['depth'] || $depth < ($args['depth']-1) ) {
            $output .= "$indent<ul>\n";
            $output .= _page_level_out1($page_id, $page_tree, $args, $new_depth, false);
            $output .= "$indent</ul>\n";
         }
      }
      $output .= "$indent</li>\n";
   }
   if ( $echo )
      echo $output;
   else
      return $output;
}
?>

andreich дарит вам акцию до 1 000р
КАТАЛОГ ПАРТНЕРОК | Бурж Гембла – тут! | RU Датинг на подписках

0
 



С нами с 15.12.03
Сообщения: 19
Рейтинг: 21

Ссылка на сообщениеДобавлено: 15/10/07 в 16:30       Ответить с цитатойцитата 

Покажи тему и что нужно в ней сделать, так будет проще помочь icon_wink.gif

0
 
Новая тема Новая тема   

Текстовая реклама в форме ответа
Заголовок и до четырех строчек текста
Длина текста до 350 символов
Купить рекламу в этом месте!


Перейти:  



Спонсор раздела Стань спонсором этого раздела!

Реклама на сайте Advertise with us

Опросы

Рецепт новогоднего блюда 2022



Обсудите на форуме обсудить (11)
все опросы »