ソースが冗長なので変更してみました。
WpPost/plg_WpPost_LC_Page.php
// 結果を格納する配列を用意
$wp_commentlist = array();
// 関数呼び出し(parent=0から開始)
// changed
// $this->search_and_push($wp_temp, $wp_commentlist, 0);
// changed
$this->search_and_push($wp_temp, $wp_commentlist, 0, 0);
// changed
$this->wp_commentlist = $wp_commentlist;
// コメント抽出関数
// changed
// function search_and_push(&$arg1, &$arg2, $arg3) {
// changed
function search_and_push(&$arg1, &$arg2, $arg3, $arg4) {
// changed
for ($i = 0; $i < count($arg1); $i++) {
$val = $arg1[$i];
if ($val["comment_parent"] <> $arg3) { continue; }
// added
$val["level"] = $arg4;
// added
array_push($arg2, $val);
// changed
// $this->search_and_push($arg1, $arg2, $val["comment_ID"]);
// changed
$this->search_and_push($arg1, $arg2, $val["comment_ID"], $arg4+1);
// changed
}
}
WpPost/media/plg_WpPost_common.css
/* added */
.wp_comment_child {
margin-top: -15px;
background: #DDD;
padding: 15px 15px 15px 30px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-khtml-border-radius: 10px;
border-radius: 10px;
}
/* added */
/* deleted
.wp_comment_child1 {
margin-top: -15px;
background: #DDD;
padding: 15px 15px 15px 30px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-khtml-border-radius: 10px;
border-radius: 10px;
}
.
.
.wp_comment_child9 {
margin-top: -15px;
background: #DDD;
padding: 15px 15px 15px 270px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-khtml-border-radius: 10px;
border-radius: 10px;
}
deleted */
WpPost/templates/plg_WpPost_post.tpl
投稿記事・コメントの改行を<br>へ変更
($wp_post.content --> $wp_post.content|nl2br)
($wp_comment.comment_content --> $wp_comment.comment_content|nl2br)
変更前
<!--{foreach from=$wp_commentlist item=wp_comment name=foo}--><!--{* コメント取り出し *}-->
<!--{if $smarty.foreach.foo.first}--><!--{* ループ1回目 *}-->
.
.
<!--{/if}--><!--{* ループ2回目以降ここまで *}-->
<!--{/foreach}--><!--{* コメント取り出しここまで *}-->
変更後
<!--{assign var="before_ID" value=0}-->
<!--{assign var="before_level" value=0}-->
<!--{foreach from=$wp_commentlist item=wp_comment name=foo}--><!--{* コメント取り出し *}-->
<!--{if ($wp_comment.comment_parent == 0) || ($wppost_comment_format == 0)}--><!--{* 親コメントの場合||入れ子しない *}-->
<!--{if $smarty.foreach.foo.first}--><!--{* 最初の親コメント *}-->
<!--{else}-->
</div><!--.wp_comment_bloc-->
<!--{/if}-->
<div class="wp_comment_bloc">
<ul class="wp_comment" id="comment<!--{$wp_comment.comment_ID}-->">
<!--{else}-->
<!--{* 入れ子 *}-->
<ul class="wp_comment_child" style="padding-left:<!--{$wp_comment.level*30}-->px; " id="comment<!--{$wp_comment.comment_ID}-->">
<!--{/if}-->
<!--{if $wp_comment.comment_author}--><li class="comment_author"><!--{$wp_comment.comment_author}--></li><!--{/if}-->
<!--{if $wp_comment.comment_author_url}--><li class="comment_author_url"><a href="<!--{$wp_comment.comment_author_url}-->" target="_blank"><!--{$wp_comment.comment_author_url}--></a></li><!--{/if}-->
<!--{if $wp_comment.comment_date}--><li class="comment_date"><!--{$wp_comment.comment_date|date_format:"%Y/%m/%d(%a)"}--></li><!--{/if}-->
<!--{if ($wppost_comment_login == 0) || (($wppost_comment_login == 1) && (($tpl_login) || ($fb_auth ==1) || ($tw_auth ==1)))}-->
<!--{* コメント可能 (ログイン不要)||((ログイン必要)&&((ログイン) || (FBログイン) || (TWログイン))) *}-->
<li class="comment_reply"><a href="#" onclick="return comment_bloc('<!--{$smarty.const.ROOT_URLPATH}-->', '<!--{$wp_root}-->', <!--{$postid}-->, <!--{$wp_comment.comment_ID}-->, <!--{$wp_comment.comment_parent}-->)">このコメントに返信</a></li>
<!--{/if}--><!--{* コメント可能ここまで *}-->
<!--{if $wp_comment.comment_content}--><li class="comment_content"><!--{$wp_comment.comment_content|nl2br}--></li><!--{/if}-->
</ul><!--.wp_comment-->
<!--{if $smarty.foreach.foo.last}--><!--{* 最後のコメント *}-->
</div><!--.wp_comment_bloc-->
<!--{/if}-->
<!--{assign var="before_ID" value=$wp_comment.comment_ID}-->
<!--{assign var="before_level" value=$wp_comment.level}-->
<!--{/foreach}--><!--{* コメント取り出しここまで *}-->
変更前
<!--{if $wppost_comment_login == 1}--><!--{* ログイン必要 *}-->
<!--{if ($tpl_login) || ($fb_auth ==1) || ($tw_auth ==1)}--><!--{* ログイン済み *}-->
<div id="page_comment">
.
.
</div><!-- #page_comment -->
<!--{/if}--><!--{* ログインここまで *}-->
変更後
<!--{if ($wppost_comment_login == 0) || (($wppost_comment_login == 1) && (($tpl_login) || ($fb_auth ==1) || ($tw_auth ==1)))}-->
<!--{* コメント可能 (ログイン不要)||((ログイン必要)&&((ログイン) || (FBログイン) || (TWログイン))) *}-->
<div id="page_comment">
<h3 id="reply-title">コメントを残す </h3>
<form action="<!--{$wp_root}-->/wp-comments-post.php" method="post" id="commentform">
<p class="comment-notes">メールアドレスが公開されることはありません。 <span class="required">*</span> が付いている欄は必須項目です</p> <p class="comment-form-author"><label for="author">名前</label> <span class="required">*</span><input id="author" name="author" type="text" value="" size="30" aria-required='true' /></p>
<p class="comment-form-email"><label for="email">メールアドレス</label> <span class="required">*</span><input id="email" name="email" type="text" value="" size="30" aria-required='true' /></p>
<p class="comment-form-url"><label for="url">ウェブサイト</label><input id="url" name="url" type="text" value="" size="30" /></p>
<p class="comment-form-comment"><label for="comment">コメント</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>
<p class="form-allowed-tags">次の<abbr title="HyperText Markup Language">HTML</abbr> タグと属性が使えます: <code><a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> </code></p>
<p class="form-submit">
<input name="submit" type="submit" id="submit" value="コメントを送信" />
<input type='hidden' name='comment_post_ID' value="<!--{$postid}-->" id='comment_post_ID' />
<input type='hidden' name='comment_parent' id='comment_parent' value='0' />
<input type='hidden' name='redirect_to' value="<!--{$smarty.const.ROOT_URLPATH}-->wppost/plg_WpPost_post.php?postid=<!--{$postid}-->" id='redirect_to' />
</p>
</form>
</div><!-- #page_comment -->
<!--{/if}--><!--{* コメント可能ここまで *}-->