Напишите, что написано в
public_html/wp-includes/comment.php:182
182 строка +10 строк и -10 строк и в
/public_html/wp-content/themes/colorpaper/functions.php on line 23
аналогично +10 строк и -10 строк.
Попробуйте переименовать функцию get_comments()
, например, в colorpaper_get_comments()
. Описана в functions.php
в каталоге темы, используется в sidebar.php
. Переименовать нужно в обоих местах.
Связано видимо с комментами, ибо когда-то работало всё, но комменты не добавлялись.
public_html/wp-includes/comment.php:182
182 строка +10 строк и -10 строк и в
/**
* Retrieve a list of comments.
*
* The comment list can be for the blog as a whole or for an individual post.
*
* The list of comment arguments are 'status', 'orderby', 'comment_date_gmt',
* 'order', 'number', 'offset', and 'post_id'.
*
* @since 2.7.0
* @uses $wpdb
*
* @param mixed $args Optional. Array or string of options to override defaults.
* @return array List of comments.
*/
function get_comments( $args = '' ) {
global $wpdb;
$defaults = array('status' => '', 'orderby' => 'comment_date_gmt', 'order' => 'DESC', 'number' => '', 'offset' => '', 'post_id' => 0);
$args = wp_parse_args( $args, $defaults );
extract( $args, EXTR_SKIP );
// $args can be whatever, only use the args defined in defaults to compute the key
$key = md5( serialize( compact(array_keys($defaults)) ) );
$last_changed = wp_cache_get('last_changed', 'comment');
if ( !$last_changed ) {
$last_changed = time();
wp_cache_set('last_changed', $last_changed, 'comment');
}
$cache_key = "get_comments:$key:$last_changed";
if ( $cache = wp_cache_get( $cache_key, 'comment' ) ) {
return $cache;
}
$post_id = absint($post_id);
if ( 'hold' == $status )
$approved = "comment_approved = '0'";
elseif ( 'approve' == $status )
$approved = "comment_approved = '1'";
elseif ( 'spam' == $status )
$approved = "comment_approved = 'spam'";
else
$approved = "( comment_approved = '0' OR comment_approved = '1' )";
$order = ( 'ASC' == $order ) ? 'ASC' : 'DESC';
$orderby = 'comment_date_gmt'; // Hard code for now
$number = absint($number);
$offset = absint($offset);
if ( !empty($number) ) {
if ( $offset )
$number = 'LIMIT ' . $offset . ',' . $number;
else
$number = 'LIMIT ' . $number;
} else {
$number = '';
}
if ( ! empty($post_id) )
$post_where = $wpdb->prepare( 'comment_post_ID = %d AND', $post_id );
else
$post_where = '';
$comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE $post_where $approved ORDER BY $orderby $order $number" );
wp_cache_add( $cache_key, $comments, 'comment' );
return $comments;
}
Вот строка 23
/public_html/wp-content/themes/colorpaper/functions.php on line 23
аналогично +10 строк и -10 строк.
/* 00 - SIDEBAR WIDGETS
/* ----------------------------------------------*/
function get_popular($limit = 7) {
global $wpdb;
$getposts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY comment_count DESC LIMIT 0,".$limit);
foreach($getposts as $thepost) {
echo '
<li><a>ID).'">'.$thepost->post_title.'</a></li>
';
}
}
function get_comments($limit = 7, $stops = 65) {
global $wpdb;
$getcomments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date DESC LIMIT 0,".$limit);
foreach($getcomments as $thecomments) {
if ( strlen ( $thecomments->comment_content ) <= $stops ) {
$comment = $thecomments->comment_content;
} else {
$comment = substr($thecomments->comment_content, 0, strrpos(substr($thecomments->comment_content, 0, $stops), ' ')) . '...';
}
echo '
<li><a>comment_post_ID).'"><span class="light"><strong>'.$thecomments->comment_author.'</strong> пишет </span> '.$comment.'</a></li>
';
}
}
function get_featured ($category) {
query_posts('category_name='.$category); if (have_posts()) : while (have_posts()) : the_post();
echo'
<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>
';
endwhile; endif;
}
function get_recent($limit) {
query_posts('showposts='.$limit); if (have_posts()) : while (have_posts()) : the_post();
echo'
<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>
';
endwhile; endif;
}
Модератор
Yuri
(@yube)
Просто до 2.7 у WordPress не было функции get_comments(), а 2.7 она появилась. И теперь конфликтует с функцией, созданной автором Темы. В Теме функцию надо переименовать.
PS Зря игнорируете рекомендацию «Поместите код в
обратные апострофы
»
Просто до 2.7 у WordPress не было функции get_comments(), а 2.7 она появилась. И теперь конфликтует с функцией, созданной автором Темы. В Теме функцию надо переименовать.
То есть переименовать? Где и что?
Сейчас попробую обновить WP. Возможно это
поможет?
Спасибо огромное to SergeyBiryukov!
Попробуйте переименовать функцию get_comments(), например, в colorpaper_get_comments(). Описана в functions.php в каталоге темы, используется в sidebar.php. Переименовать нужно в обоих местах.
Ваш совет мне помог!
Правда я протупил потом и сохранил с БОМ, так что потом вылезло
яЛП, но Notepad++ все спас:)