“Comments.php”在可湿性粉剂管理中编辑后不可用

时间:2015-02-02 作者:DataSmarter

在主题“Point”中,“comments.php”页面没有正确翻译。我想在WP管理编辑器中手动翻译标签(法语),但是when I update the file, the comments doesn\'t appear anymore on my website.

然而,我只是改变了标签。知道我做错了什么吗?

此问题是否与主题或我的WP安装相关?

Here is the code before:

    <?php

// Do not delete these lines
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\',\'mythemeshop\'); ?>.</p>
<?php return; } ?>
<!-- You can start editing here. -->
<?php if ( have_comments() ) : ?>
    <div id="comments">
        <div class="total-comments"><?php comments_number(__(\'No Comments\',\'mythemeshop\'), __(\'One Comment\',\'mythemeshop\'),  __(\'% Comments\',\'mythemeshop\') );?></div>
        <ol class="commentlist">
            <div class="navigation">
                <div class="alignleft"><?php previous_comments_link() ?></div>
                <div class="alignright"><?php next_comments_link() ?></div>
            </div>
            <?php wp_list_comments(\'type=comment&callback=mts_comment\'); ?>
            <div class="navigation bottomnav">
                <div class="alignleft"><?php previous_comments_link() ?></div>
                <div class="alignright"><?php next_comments_link() ?></div>
            </div>
        </ol>
    </div>
<?php else : // this is displayed if there are no comments so far ?>
    <?php if (\'open\' == $post->comment_status) : ?>
        <!-- If comments are open, but there are no comments. -->
    <?php else : // comments are closed ?>
        <!-- If comments are closed. -->
        <p class="nocomments"></p>
    <?php endif; ?>
<?php endif; ?>
<?php if (\'open\' == $post->comment_status) : ?>
    <div class="bordersperator2"></div>
    <div id="commentsAdd">
        <div id="respond" class="box m-t-6">
            <?php global $aria_req; $comments_args = array(
                \'title_reply\'=>\'<h4><span>\'.__(\'Add a Comment\',\'mythemeshop\').\'</span></h4></h4>\',
                \'comment_notes_after\' => \'\',
                \'label_submit\' => \'Add Comment\',
                \'comment_field\' => \'<p class="comment-form-comment"><label for="comment">\'.__(\'Comment:\',\'mythemeshop\').\'<span class="required">*</span></label><textarea id="comment" name="comment" cols="45" rows="5" aria-required="true"></textarea></p>\',
                \'fields\' => apply_filters( \'comment_form_default_fields\',
                    array(
                    \'author\' => \'<p class="comment-form-author">\' 
                        . \'<label for="author">\' . __( \'Name\', \'mythemeshop\' ) . \':<span class="required">*</span></label>\' 
                        . ( $req ? \'\' : \'\' ) . \'<input id="author" name="author" type="text" value="\' . esc_attr( $commenter[\'comment_author\'] ) . \'" size="30"\' . $aria_req . \' /></p>\',

                    \'email\' => \'<p class="comment-form-email"><label for="email">\' . __( \'Email Address\', \'mythemeshop\' ) . \':<span class="required">*</span></label>\' 
                        . ( $req ? \'\' : \'\' ) . \'<input id="email" name="email" type="text" value="\' . esc_attr(  $commenter[\'comment_author_email\'] ) . \'" size="30"\' . $aria_req . \' /></p>\',

                    \'url\' => \'<p class="comment-form-url"><label for="url">\' . __( \'Website\', \'mythemeshop\' ) . \':</label>\' . 
            \'<input id="url" name="url" type="text" value="\' . esc_attr( $commenter[\'comment_author_url\'] ) . \'" size="30" /></p>\' 
            ))
            ); 
            comment_form($comments_args); ?>
        </div>
    </div>
<?php endif; // if you delete this the sky will fall on your head ?>

And here after the changes:

<?php

// Do not delete these lines
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\',\'mythemeshop\'); ?>.</p>
<?php return; } ?>
<!-- You can start editing here. -->
<?php if ( have_comments() ) : ?>
    <div id="comments">
        <div class="total-comments"><?php comments_number(__(\'Pas de Commentaires\',\'mythemeshop\'), __(\'1 Commentaire\',\'mythemeshop\'),  __(\'% Commentaires\',\'mythemeshop\') );?></div>
        <ol class="commentlist">
            <div class="navigation">
                <div class="alignleft"><?php previous_comments_link() ?></div>
                <div class="alignright"><?php next_comments_link() ?></div>
            </div>
            <?php wp_list_comments(\'type=comment&callback=mts_comment\'); ?>
            <div class="navigation bottomnav">
                <div class="alignleft"><?php previous_comments_link() ?></div>
                <div class="alignright"><?php next_comments_link() ?></div>
            </div>
        </ol>
    </div>
<?php else : // this is displayed if there are no comments so far ?>
    <?php if (\'open\' == $post->comment_status) : ?>
        <!-- If comments are open, but there are no comments. -->
    <?php else : // comments are closed ?>
        <!-- If comments are closed. -->
        <p class="nocomments"></p>
    <?php endif; ?>
<?php endif; ?>
<?php if (\'open\' == $post->comment_status) : ?>
    <div class="bordersperator2"></div>
    <div id="commentsAdd">
        <div id="respond" class="box m-t-6">
            <?php global $aria_req; $comments_args = array(
                \'title_reply\'=>\'<h4><span>\'.__(\'Ajouter un  Commentaire\',\'mythemeshop\').\'</span></h4></h4>\',
                \'comment_notes_after\' => \'\',
                \'label_submit\' => \'Ajouter un Commentaire\',
                \'comment_field\' => \'<p class="comment-form-comment"><label for="comment">\'.__(\'Commentaire:\',\'mythemeshop\').\'<span class="required">*</span></label><textarea id="comment" name="comment" cols="45" rows="5" aria-required="true"></textarea></p>\',
                \'fields\' => apply_filters( \'comment_form_default_fields\',
                    array(
                    \'author\' => \'<p class="comment-form-author">\' 
                        . \'<label for="author">\' . __( \'Nom\', \'mythemeshop\' ) . \':<span class="required">*</span></label>\' 
                        . ( $req ? \'\' : \'\' ) . \'<input id="author" name="author" type="text" value="\' . esc_attr( $commenter[\'comment_author\'] ) . \'" size="30"\' . $aria_req . \' /></p>\',

                    \'email\' => \'<p class="comment-form-email"><label for="email">\' . __( \'Adresse email\', \'mythemeshop\' ) . \':</label>\' 
                        . ( $req ? \'\' : \'\' ) . \'<input id="email" name="email" type="text" value="\' . esc_attr(  $commenter[\'comment_author_email\'] ) . \'" size="30"\' . $aria_req . \' /></p>\',

                    \'url\' => \'<p class="comment-form-url"><label for="url">\' . __( \'Site internet\', \'mythemeshop\' ) . \':</label>\' . 
            \'<input id="url" name="url" type="text" value="\' . esc_attr( $commenter[\'comment_author_url\'] ) . \'" size="30" /></p>\' 
            ))
            ); 
            comment_form($comments_args); ?>
        </div>
    </div>
<?php endif; // if you delete this the sky will fall on your head ?>

1 个回复
最合适的回答,由SO网友:IlmarsL 整理而成

您的翻译代码似乎工作正常。我试着把它放进去comments.php 并且评论正在出现(至少在显示单个帖子时)。尝试禁用插件并检查是否意外删除了对的调用comments_template().

尽管如此,这确实不是你应该翻译WordPress主题的方式。有很多关于这个主题的教程,如果你做了很多翻译,你可能应该去看看。

结束

相关推荐

子主题函数的正确入队.php

我一开始并没有设置儿童主题,所以现在我正在尝试这样做。我确实激活了儿童主题。我读了一遍POST 仍然无法获得我的孩子主题风格。css先挂接,然后再挂接其他内容。我不太熟悉编码,也不知道如何编写函数。php for my child主题我的父主题使用3个样式表;风格css,自定义。css和绿色。css(后者是将绿色作为按钮等的主要颜色)。当我改变我的孩子主题风格时。css通常不会生效。由于数据库中存在一些缓存问题(我想是因为)一个旧的自定义。css似乎正在开创先例。说来话长,但由于web主机帐户升级迁移出错