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.

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

报告相同问题?

悬赏问题

  • ¥15 Java与Hbase相关问题
  • ¥20 bash代码推送不上去 git fetch origin master #失败了
  • ¥15 LOL外服加入了反作弊系统,现在游戏录像rofl文件离线都无法打开
  • ¥45 工程软件单片机设计课题要求
  • ¥15 在centos7安装conda
  • ¥15 c#调用yolo3 dll文件获取的数据对不上
  • ¥20 WPF 如何实现多语言,label 和cs(live Charts)中是否都能翻译
  • ¥15 STM32F103上电短路问题
  • ¥15 打开软件提示错误:failed to get wglChoosePixelFormatARB
  • ¥15 (标签-python|关键词-char)