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.

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

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!