评论部分没有出现在没有评论的帖子上

时间:2012-10-26 作者:Loki

最近,我在Themeforest为我的写作博客买了一个名为Ravage的主题。

昨天我发现,当一篇帖子没有评论时,它不会显示“漂亮”的评论部分(它有一个时尚的时事通讯注册表单和社会共享链接)。

我一直在浏览评论。php,但我似乎不知道这个“问题”在哪里。我试图联系Ice Pixels(创建者)的支持,但他们给我看了一个隐藏在主题演示中的页面,该页面也显示了这种奇怪的行为。所以对他们来说,这是:“照原样来,我们不会改变任何事情”。

我无法想象这个星球上有一个博主会等人们分享他的作品,直到发表第一条评论,所以我希望这里有人能帮助我。

下面是一篇评论文章:http://www.ifkknrokk.com/rants/psychology/478/7-steps-dysthymia/

以下是一篇没有评论的帖子:http://www.ifkknrokk.com/writing/poetry/86/poem-honesty/

正如您在底部有评论的页面上所看到的,一个灰色方框区域显示了共享链接、订阅表单和所有内容!在没有注释的页面上,它不会显示在任何地方。

以下是我的评论。php:

<?php $template_directory =  get_template_directory_uri(); ?>
<?php

// Do not delete these lines or the sky will fall over your head
if (!empty($_SERVER[\'SCRIPT_FILENAME\']) && \'comments.php\' == basename($_SERVER[\'SCRIPT_FILENAME\']))
die (\'Please do not load this page directly. Thanks!\');

if ( post_password_required() ) { ?>
<p class="nocomments"><?php _e(\'This post is password protected. Enter the password to view comments.\', \'framework\') ?></p>
<?php
return;
}

/*-----------------------------------------------------------------------------------*/
/*  Display the comments + Pings
/*-----------------------------------------------------------------------------------*/

if ( have_comments() ) : // if there are comments ?>
<?php if ( ! empty($comments_by_type[\'comment\']) ) : // if there are normal comments ?>
<div class="comments-container span12">
<div class="share-post">
<?php if( function_exists(\'zilla_likes\') ) : ?> <?php zilla_likes(); ?> / <?php endif; ?><a class="facebook" href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>" target="blank"><i class="icon-thumbs-up"></i> <?php _e(\'Like\', \'framework\'); ?></a> / <a href="http://twitter.com/home?status=<?php the_title(); ?> - <?php the_permalink();?>" target="blank" class="twitter"><i class="icon-twitter"></i> <?php _e(\'Tweet\', \'framework\'); ?></a>
</div>

<div class="subscribe-box">
<style>
.dcstyle{
background:url(http://www.ifkknrokk.com/wp-content/uploads/2012/10/mail.png) white no-    repeat scroll 1px center; padding:7px 7px 7px 50px; color:#666; font-weight:bold; text-decoration:none; border:1px solid #D3D3D3; 
}
</style>

<center>
<table style=\'border: none; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;\' width=\'100%\'>
<tbody>

<tr style=\'border:none; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;\'>

<td align=\'center\' style=\'border:none; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;\'> <p style=\'color:#666; font-weight: bold; font-style: italic; font-size: 22px; margin:0px 0px 5px 0px; \'>Receive free daily updates.</p>
<form action=\'http://feedburner.google.com/fb/a/mailverify\' class=\'feedburner\' method=\'post\' onsubmit=\'window.open(&apos;http://feedburner.google.com/fb/a/mailverify?uri=ifkknrokk&apos;, &apos;popupwindow&apos;, &apos;scrollbars=yes,width=550,height=520&apos;);return true\' style=\'margin: 0pt;\' target=\'popupwindow\'>
<input name=\'uri\' type=\'hidden\' value=\'ifkknrokk\'/>
<input name=\'loc\' type=\'hidden\' value=\'en_US\'/>
<input style="width: 250px;" class=\'dcstyle\' name=\'email\' onblur=\'if (this.value == &quot;&quot;) {this.value = &quot;Enter your email…&quot;;}\' onfocus=\'if (this.value == &quot;Enter your email…&quot;) {this.value = &quot;&quot;}\' type=\'text\' value=\'Enter your email…\'/>
&nbsp;
<input style="width: 90px;" alt=\'\' class=\'dcsubmit\' title=\'\' type=\'submit\' value=\'Submit\'/>
<br>
<font size="1"><a href=\'http://feeds.feedburner.com/ifkknrokk\' rel=\'nofollow\' target=\'_blank\' title=\'Subscribe to RSS Feed\'>Or add this feed to your RSS-reader.</a>
</font>
</form>
</td>
<td align="center" style=\'border:none; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;\'><p style=\'color:#666; font-style: italic; font-weight: bold; font-size: 22px; margin:0px 0px 5px 0px; \'>Connect with me.</p>

<a href="http://twitter.com/ifkknrokk" rel=\'nofollow\' target=\'_blank\' title=\'Follow us on Twitter\'><img src=\'http://www.ifkknrokk.com/wp-content/uploads/2012/10/twitter.png\'/>        </a>
<a href="https://plus.google.com/u/0/109115922375442320105/about" rel=\'nofollow\' target=\'_blank\' title=\'Follow us on Google+\'><img src=\'http://www.ifkknrokk.com/wp-content/uploads/2012/10/google+.png\'/></a>
<a href="http://www.facebook.com/ifkknrokk" rel=\'nofollow\' target=\'_blank\' title=\'Follow us on Facebook\'><img src=\'http://www.ifkknrokk.com/wp-content/uploads/2012/10/facebook.png\'/></a>
<a href="http://youtube.com/user/ifkknrokk" rel="nofollow" target="_blank" title="Subscribe to my Youtube-channel!"><img src="http://www.ifkknrokk.com/wp-content/uploads/2012/10/you_tube.png"/></a>

</td>
</tr>
</tbody></table>
</div>

<div class="comments-message">
<?php if(get_option(\'icy_comments_message\') == \'\') : ?>
<?php _e(\'Write us your thoughts about this post. Be kind & Play nice.\', \'framework\'); ?>
<?php else : ?>
<?php echo get_option(\'icy_comments_message\'); ?>
<?php endif; ?>     
</div>

<!-- BEGIN .list-of-comments -->    
<div class="span12 commentaries-border">

<!--BEGIN .list-of-comments OUTPUT -->
<ol id="comments" class="list-of-comments">

<?php wp_list_comments(\'type=comment&avatar_size=48&callback=icy_comment\'); ?>

<!--END .list-of-comments OUTPUT -->
</ol>

<?php endif; ?>

<?php if ( ! empty($comments_by_type[\'pings\']) ) : // if there are pings ?>


<!--START separated pings listing -->
<h4 id="pings"><?php _e(\'Trackbacks for this post\', \'framework\') ?></h4>

<ol class="pinglist">

<?php wp_list_comments(\'type=pings&callback=icy_list_pings\'); ?>

</ol>
<!--END separated pings listing -->



<?php endif; ?>

<!--BEGIN comment navigation -->
<div class="navigation">

<div class="alignright"><?php next_comments_link(); ?></div>
<div class="alignleft"><?php previous_comments_link(); ?></div>

<!--END comment navigation -->
</div>

<!--END .list-of-comments -->
</div>

<?php

/*-----------------------------------------------------------------------------------*/
/*  Dealing with no comments or closed comments
/*-----------------------------------------------------------------------------------*/

if (\'closed\' == $post->comment_status ) : // if the post has comments but comments are now closed ?>

<p class="nocomments"><?php _e(\'Comments are closed now.\', \'framework\') ?></p>

<?php endif; ?>

<?php else :  ?>

<?php if (\'open\' == $post->comment_status) : // if comments are open but no comments so far ?>

<?php else : // if comments are closed ?>

<?php if (is_single()) { ?><p class="nocomments"><?php _e(\'Comments are closed.\', \'framework\') ?></p><?php } ?>

<?php endif; ?>

<?php endif;

/*-----------------------------------------------------------------------------------*/
/*  Comment Form
/*-----------------------------------------------------------------------------------*/

if ( comments_open() ) : ?>

<div id="respond" class="span12" style="margin-left: 0">

<h3 class="no-bottom"><?php comment_form_title( __(\'Leave a reply.\', \'framework\'), __(\'Reply to %s\', \'framework\') ); ?></h3>

<div class="cancel-comment-reply">       
<?php cancel_comment_reply_link(); ?>
</div>

<?php if ( get_option(\'comment_registration\') && !is_user_logged_in() ) : ?>    
<p><?php printf(__(\'You must be %1$slogged in%2$s to post a comment.\', \'framework\'), \'<a href="\'.get_option(\'siteurl\').\'/wp-login.php?redirect_to=\'.urlencode(get_permalink()).\'">\', \'</a>\') ?></p> 
<?php else : ?>

<form action="<?php echo get_option(\'siteurl\'); ?>/wp-comments-post.php" method="post" class="span12" id="comments-form" style="margin-left: 0">

<?php if ( is_user_logged_in() ) : ?>       
<p><?php printf(__(\'Logged in as %1$s. %2$sLog out &raquo;%3$s\', \'framework\'), \'<a href="\'.get_option(\'siteurl\').\'/wp-admin/profile.php">\'.$user_identity.\'</a>\', \'<a href="\'.(function_exists(\'wp_logout_url\') ? wp_logout_url(get_permalink()) : get_option(\'siteurl\').\'/wp-login.php?action=logout" title="\').\'" title="\'.__(\'Log out of this account\', \'framework\').\'">\', \'</a>\') ?></p>        
<?php else : ?>

<p>
<input type="text" name="author" value="Name (required)" id="author" value="<?php echo esc_attr($comment_author); ?>" size="20" tabindex="1" onfocus="if (this.value == \'Name (required)\') {this.value = \'\';}" onblur="if (this.value == \'\') {this.value = \'Name (required)\';}"/>
</p>

<p>
<input type="text" name="email" value="Email (required)"  id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="20" tabindex="2" onfocus="if (this.value == \'Email (required)\') {this.value = \'\';}" onblur="if (this.value == \'\') {this.value = \'Email (required)\';}"/>
</p>

<p>
<input type="text" name="url" id="url" value="Your Website" size="20" tabindex="3"onfocus="if (this.value == \'Your Website\') {this.value = \'\';}" onblur="if (this.value == \'\') {this.value = \'Your Website\';}"/>
</p>

<?php endif; ?>

<p>
<textarea name="comment" id="comment" cols="55" rows="10" tabindex="4" value="Write your comment here" onfocus="if (this.value == \'Write your comment here\') {this.value = \'\';}" onblur="if (this.value == \'\') {this.value = \'Write your comment here\';}"></textarea>
</p>

<p class="no-bottom">
<input name="submit" type="submit" id="submit" tabindex="5" value="<?php _e(\'Submit Comment\', \'framework\') ?>" />
<?php comment_id_fields(); ?>
</p>
<?php do_action(\'comment_form\', $post->ID); ?>

</form>

<?php endif; // If registration required and not logged in ?>
</div>
<?php endif; // if you delete this the sky will fall on your head ?>
我真的希望你们中的一个能找到解决办法,因为这太令人沮丧了(尤其是因为设计师不想帮助我-他刚刚给我发了一封电子邮件,他一回到家就会调查一下,看是否可能(!)当然有可能!其他人都在这么做!

无论如何,很抱歉投诉,非常感谢您的帮助。

当做

达恩·范登伯格

1 个回复
SO网友:Loki

已经修复了。

我将整个代码移到了和之间。只留下评论。php来处理注释字段。

现在我想了想,评论。php是一个非常奇怪的地方,它为共享链接等设置了布局样式。其他人总是把它放在一个单独的地方。php。

结束

相关推荐

正在尝试编辑Archive.php以仅显示帖子摘录,并带有特色图像

我使用两个主题(完整主题和桌面主题),所以我试图让它们以类似的方式运行。存档。用于移动主题的php正在做我想要做的事情,即只显示标题和帖子摘录。我认为这是一段代码:<?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( \'content\', get_post_format() ); ?> <?php endwhile; ?> 存档。桌面网站的php