Последние комментарии блога
Откройте блок последних комментариев блога: для этого откройте приложение «Сайт» и в левом меню выберите раздел «Блоки». Найдите в списке блоков блок с названием «blog.latest_comments». Замените всё содержимое блока следующим кодом:
<style> .comments { list-style: none; line-height: 1.1em; } .comments .comment { padding: 15px 0 25px; } .comments .credentials { overflow: hidden; line-height: 1.3em; padding: 10px 0px; font-size: 90%; } .comments .credentials a, .comments .credentials span { display: inline-block; vertical-align: middle; padding-left: 0 !important; } .comments .credentials a, .comments .credentials a img { padding: 0px; margin: 0;} .comments .credentials .username { font-weight: bold; } </style> <ul class="menu-v with-icons comments"> {$latest_comments = $wa->blog->comments()} {foreach $latest_comments as $comment} <li> <div class="comment" > <div class="credentials"> <a name="comment{$comment.id}"{if $comment.site} href="{$comment.site}"{/if}> <img src="{$comment.user.photo_url_20|default:$comment.user.photo_url}" class="userpic{if $comment.auth_provider && ($comment.auth_provider neq blogCommentModel::AUTH_GUEST) && ($comment.auth_provider neq blogCommentModel::AUTH_USER)} icon16{/if}" alt=""> </a> {if empty($comment.site)} <span class="username">{$comment.name}</span> {else} <a href="{$comment.site}" class="username">{$comment.name}</a> {/if} {* @event prepare_comments_frontend.%plugin_id%.authorname_suffix *} {if !empty($comment.plugins.authorname_suffix)} {foreach $comment.plugins.authorname_suffix as $plugin => $output}{$output}{/foreach} {/if} <span class="hint date" title="{$comment.datetime|wa_datetime}">{$comment.datetime|wa_datetime:"humandatetime"}</span> {if isset($comment.post) && $comment.post && (!isset($single_view) || !$single_view)} <span class="hint"> в {if isset($comment.post) && $comment.post && $comment.editable || (isset($comment.post) && $comment.post && $comment.post.status eq blogPostModel::STATUS_PUBLISHED)} <a href="{if $comment.post.status eq blogPostModel::STATUS_PUBLISHED && $comment.post.blog_status eq blogBlogModel::STATUS_PUBLIC && $comment.post.link}{$comment.post.link}{else}?module=post&id={$comment.post_id}{if $comment.post.status eq blogPostModel::STATUS_PUBLISHED}#comments{else}&action=edit{/if}{/if}" class="bold">{$comment.post.title|escape}</a> {else} unpublished post {/if} </span> {/if} </div> {* @event prepare_comments_frontend.%plugin_id%.before *} {if !empty($comment.plugins.before)} {foreach $comment.plugins.before as $plugin => $output}{$output}{/foreach} {/if} <div class="text">{$comment.text|nl2br}</div> {* @event prepare_comments_frontend.%plugin_id%.after *} {if !empty($comment.plugins.after)} {foreach $comment.plugins.after as $plugin => $output}{$output}{/foreach} {/if} </div> </li> {foreachelse} <li>no comments</li> {/foreach} </ul>
После сохранения изменений вы сможете добавлять последние записи блога на любую страницу сайта, вставив код вызова блока:
{$wa->block("blog.latest_comments")}