dongyan3237 2015-04-28 07:44
浏览 49
已采纳

为什么我在本地环境(仅在原始服务器上)上的Wordpress博客帖子上收到错误消息?

I copied all my WP files from the server to my local WAMP as a dev-environment. Everything works smoothly except when viewing a blog post.

I get a good output of all the titles/categories/post-content/ect' - But with a strange output before the blogs content:

http://i.stack.imgur.com/JTKJ5.png <code>enter image description here</code>

content.php Line 68 is this part in the code: __( ),

One line after "the_content" function:

<div class="post-bottom">
    <div class="post-text-container">
        <?php
            /* translators: %s: Name of current post*/
            $postURL = get_permalink();
            $commentsURL = get_comments_link();
            the_content( sprintf(
                __(  ),
                the_title( '<span class="screen-reader-text">', '</span>', false )
            ) );
            if ( !is_single() ) :
                    echo "<div class=\"read-more\"><a href=\"$postURL\">Continue reading...</a> | <a href=\"$commentsURL\">Full Comments</a></div>";
                endif;
        ?>
    </div>
</div>

What can be the cause of this?

Edit: the only things that I changed when coping stuff to my local server were:

1 - I copied my database to my local phpmyadmin and changed all http://www.example.com to http://localhost/example in the options table.

2 - I totally removed my .htaccess file (and wordpress generated a new one by it self)

This is how the one on the server looks:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

and this is what I have locally:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /example/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /example/index.php [L]
</IfModule>

# END WordPress

3- I enabled "rewrite_modle" on WAMP because it's disabled by default.

  • 写回答

2条回答 默认 最新

  • doulun7739 2015-04-28 08:12
    关注

    The warning is regarding the following part of your code: __( ).

    In WP __ is actually a function for translation purposes.

    From a short look in the manual, we can see that the __() function usage is:

    <?php $translated_text = __( $text, $domain ); ?>
    

    And that the $text parameter is required.

    $text (string) (required) Text to translate. Default: None $domain

    (string) (optional) Domain to retrieve the translated text. Default: 'default'

    In your code, you don't send any argument to that function and therefore you're getting a legit warning. To be honest, I don't know why there was no argument in the first place. Moreover, also your remote server should show that warning. In case it doesn't - or the code is different or you have error_reporting(0) somewhere on the server (php.ini / wp-config.php).

    A simple solution would be just to add an empty string as an argument.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭