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条)

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料