PDA

View Full Version : سوال: افزودن استایل در میان کدهای php



Mehr@ban
جمعه 21 آبان 1395, 21:06 عصر
سلام بر دوستان

من میخوام به کدهای زیر استایل بدم، اما همش خطا دریافت میکنم و صفحه سفید میشه!
کدها مربوط به آخرین نظرات در وردپرس هست.


<?php
function src_simple_recent_comments($src_count=7, $src_length=60, $pre_HTML='<li><h2> تازه‌ترین دیدگاه‌ها </h2>', $post_HTML='</li>') {
global $wpdb;
$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,
SUBSTRING(comment_content,1,$src_length) AS com_excerpt
FROM $wpdb->comments
LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID)
WHERE comment_approved = '1' AND comment_type = '' AND post_password = ''
ORDER BY comment_date_gmt DESC
LIMIT $src_count";
$comments = $wpdb->get_results($sql);
$output = $pre_HTML;
$output .= "\n<ul>";
foreach ($comments as $comment) {
$output .= "\n\t<li><p><a href=\"" . get_permalink($comment->ID) . "#comment-" . $comment->comment_ID . "\" title=\"ثبت شده در " . $comment->post_title . "\">" . $comment->comment_ID . "#</a> - کاربر محترم با نام <strong>" . $comment->comment_author . "</strong> در نوشته <strong>" . $comment->post_title . "</strong> گفته:<br> " . strip_tags($comment->com_excerpt) . " <a href=\"" . get_permalink($comment->ID) . "#comment-" . $comment->comment_ID . "\" title=\"ثبت شده در " . $comment->post_title . "\">← ...</a></p></li>";
}
$output .= "\n</ul>";
$output .= $post_HTML;
echo $output;
}
?>
<?php if (function_exists('src_simple_recent_comments')) {
src_simple_recent_comments(100, 150,'', ''); }
?>

Mehr@ban
جمعه 21 آبان 1395, 21:15 عصر
البته بنظرم باید خط شماره 15 پست قبلی ویرایش بشه
که میشه خط زیر:


$output .= "\n\t<li><p><a href=\"" . get_permalink($comment->ID) . "#comment-" . $comment->comment_ID . "\" title=\"ثبت شده در " . $comment->post_title . "\">" . $comment->comment_ID . "#</a> - کاربر محترم با نام <strong>" . $comment->comment_author . "</strong> در نوشته <strong>" . $comment->post_title . "</strong> گفته: " . strip_tags($comment->com_excerpt) . " <a href=\"" . get_permalink($comment->ID) . "#comment-" . $comment->comment_ID . "\" title=\"ثبت شده در " . $comment->post_title . "\">← ...</a></p></li>";

Mehr@ban
یک شنبه 23 آبان 1395, 23:16 عصر
کسی نبود یاری کند؟