duanhuoyao7011 2014-05-28 19:24
浏览 74
已采纳

Patchwork主题的patchwork_posted_on()方法不适用于最新的Wordpress

I just upgraded a blog I host to WordPress 3.9.1. On that blog, I use the Patchwork theme. Following that, the blog stopped working. I couldn't see any serverside PHP errors - that's likely due to a misconfiguration of my logging. On the browser side, I could see I was getting HTTP 500 with Chrome's Developer Tools.

I eventually realized the problem came from this method in the Patchwork theme:

function patchwork_posted_on() {
    printf( __( 'Posted on <a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a><span class="byline"> by <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'patchwork' ),
        esc_url( get_permalink() ),
        esc_attr( get_the_time() ),
        esc_attr( get_the_date( 'c' ) ),
        esc_html( get_the_date() ),
        esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
        esc_attr( sprintf( __( 'View all posts by %s', 'patchwork' ), get_the_author() ) ),
        esc_html( get_the_author() )
    );
}

I haven't done a lot of PHP in a while so I'm struggling to see what's wrong with it. Considering it worked with Wordpress 3.9.0 and it doesn't work anymore, I am tempted to say that one of the methods here has been deprecated.

Does anyone have an idea?

--- EDIT ---

I didn't write the theme and it hasn't been updated in a very long time so the issue must come from a change either in wordpress that breaks the theme or in another plugin I could have updated.

Also, the error that I get is that the post page gets generated all the way up to the title and then when it's about to print Posted on ... By ... it dies. That is in fact what led me to investigate whatever was being called at that point.

Thanks.

  • 写回答

2条回答 默认 最新

  • dougu2036 2014-07-13 14:27
    关注

    From what I can gather, get_the_date() is the one creating the problem. I can still find pages at wordpress describing it but it is not in the function index.

    I updated my code to use get_the_time only:

    echo __('<!--:en-->By <!--:--><!--:fr-->Par <!--:-->'.'<a class="url fn n" href="'.esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ).'" title="Voir tous les articles de '.esc_html( get_the_author() ).'" rel="author">'.esc_html( get_the_author() ).'</a><!--:en--> on '.get_the_time('F j, Y').'<!--:--><!--:fr--> le '.get_the_time('j F Y').'<!--:-->' );
    

    BTW, since then, I had the issue on another blog - separate wordpress on the same PHP server.

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

报告相同问题?

悬赏问题

  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应