doulu8415 2019-07-04 13:19
浏览 359
已采纳

使用页面或发布自定义模板时,the_content突然不显示内容

I had to fall back to an earlier version of the site. It went right back to working as intended. I updated the woocommerce plug-in. All still worked. Suspect the Jetpack plug-in causing the trouble but can't prove it. (I deactivated it when troubleshooting but that didn't fix problem.) I just got email from GoDaddy saying they had detected the old version of Jetpack is causing a fatal error. I haven't seen an error yet but I believe them. Deactivated it and will probably uninstall it if I can use other plug-ins for the same features.

As I work to restore the posts I added in the last couple days, I'll make note if anything stops working and will report it here in case anyone else ever hits the same problem. TY.

https://fromstrawintogold.com/photo-album-index/warping-a-loom-front-to-back-ftb/


the_content and the_date in post and page template files not working

All was well. Custom page and post template worked as intended on WordPress site for months. Only used these custom templates for photo albums and blog. (Using child theme of Storefront theme. All store related pages use WooCommerce templates, unaltered.)

Suddenly, yesterday, custom page and post templates stopped displaying the content and the date. I had added products to WooCommerce but no changes to code. Added demo products in past with no problem.

When I saw the problem, I turned all plug-ins off, including WooCommerce - malfunction continues. I just can't figure out why code that worked suddenly refused to pick up the_content and date, especially when I had made no changes to the templates that morning.

  • Turned off plug-ins.
  • Looked at functions.php to see if anything affected the_content. Didn't see anything and custom functions file is the same as when the_content worked.
  • Pulled up pages and posts in Chrome - no errors detected, though it doesn't show the_content being called.

If I must, I'll restore a version of the site from days ago to see if the problem clears up but would rather avoid that if possible.

From picture album post template:

<div class="hundred">
    <div class="sixty-o-pic">
        <div class="secondborder">
        <?php the_post_thumbnail(); ?>
        </div>
    </div>
    <div class="forty-o-pic">
        <div class="hundred-o-comment">
        <h1> <?php the_title() ; ?> </h1>
        <h2> <?php echo get_post(get_post_thumbnail_id())->post_excerpt; ?> 
        </h2>
        <?php the_content(); ?>
        <hr />
        <div class="mininavbox">
            <!-- buttons -->
            <div class="miniholder">
                <?php echo previous_post_link('<strong>%link</strong>','<img src="https://fromstrawintogold.com/wp-content/uploads/2019/06/arrow-left-58x58.png">', TRUE); ?>
            </div>
        <?php if( in_category('52') ) : ?>
        <div class="miniholdercenter">
            <a class="one" href="https://fromstrawintogold.com/photo-album-index/around-the-ranch/"><img src="https://fromstrawintogold.com/wp-content/uploads/2019/07/arrowcircle-58x58.png" alt="return to album index" align="middle"></a>
        </div>
    <?php elseif( in_category('53') ) : ?>
        <div class="miniholdercenter">
            <a class="one" href="https://fromstrawintogold.com/photo-album-index/warping-a-loom-front-to-back-ftb/"><img src="https://fromstrawintogold.com/wp-content/uploads/2019/07/arrowcircle-58x58.png" alt="return to album index" align="middle" margin="auto"></a>
        </div>
    <?php elseif( in_category('54') ) : ?>
        <div class="miniholdercenter">
            <a class="one" href="https://fromstrawintogold.com/photo-album-index/sunrise-blanket/"><img src="https://fromstrawintogold.com/wp-content/uploads/2019/07/arrowcircle-58x58.png" alt="return to album index" align="middle" margin="auto"></a>                                                                              
        </div>
    <?php else : ?>
        <div class="navholdercenter">
            <a class="one" href=" https://fromstrawintogold.com/photo-album-index/">Photo Albums</a>
        </div>
    <?php endif ; ?>
    <div class="miniholder">
        <?php echo next_post_link('<strong>%link</strong>','<img src="https://fromstrawintogold.com/wp-content/uploads/2019/06/arrow-right-58x58.png">', TRUE); ?> 
        </div>
    </div>
</div>
<div class="hundred-o-comment">
    <?php if ( comments_open() || get_comments_number() ) { 
comments_template(); } ?>
</div>

Expect content and date to show as they did right up till yesterday morning. Instead, they don't. I'm baffled.

  • 写回答

1条回答 默认 最新

  • dshp9580656 2019-07-10 13:08
    关注

    I'm having a similar issue with my client's wordpress site also hosted on GoDaddy. "the_content" just recently stopped working. I have reviewed the code, and everything seems to be in line with the information I have found regarding "the_content" and it's use. I was upgraded to Gutenberg, but that was a while ago and it was working. Now it's using wp version 5.2.2, and I have no idea why it's suddenly stopped working. I can the new "block" editor's content to post, but not via the_content. Really strange.

    I hate to say it, but I suspect it has something to do with GoDaddy's "Managed Wordpress" hosting service which autoupdates wordpress core and god knows what else. It also has sucuri's firewall added to the site via GoDaddy if that helps fill in some of the gaps on what else might be happening.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站