dsj2014 2016-11-09 05:12
浏览 136
已采纳

WordPress代码更改没有发生

I am trying to add time for each post in WordPress website.

I have figured out that editing the single.phpfile will change the look of the page.

Here is my single.php file's code :

<div <?php post_class( 'singlep') ?>id="post-
  <?php the_ID(); ?>" style="background:none;">



  <h2 class="titles"><?php the_title(); ?></h2>

  <div style="border-bottom: 1px solid #bbb;border-top: 1px solid #bbb;overflow: hidden;padding: 10px;margin: 10px 0;">
    <p style="margin: 0 !important; float: left;">By
      <?php the_author_posts_link(); ?>
    </p>

    <p style="margin: 0 !important;float: right;color: #bbb;">
      <?php the_date( 'j M, Y g:i A', '', ''); ?>
    </p>
  </div>



</div>

Problems

  1. The date is not displayed.

  2. Even if I remove the title code (was doing to check if any changes are even being made or not <h2 class="titles"><?php the_title(); ?></h2> , the title still remains.

  3. That brought me to a conclusion that none of the changes that I'm making are reflecting in the web. But then when I made changes to remove few social plugins on the page, they were successfully removed. Removing the code is removing the plugin, meaning that the code changes made in the file are working.

What is happening here? How do I get the dates to be displayed? Why aren't a few specific changes being made but a few are?

I have cleared the browser cache and all. Still no luck.

  • 写回答

1条回答 默认 最新

  • drnbotxo449747 2016-11-09 05:56
    关注

    Below are the valid reasons of this issue.

    Please go through all the points and you will able to modify your single.php code.

    • okay here main issue is caching plugin , firstly find the caching plugin which installed in your site and deactivate it.

    • Secondly make sure you are changin your code in the current active theme file - if child theme is installed then do it in child theme only.

    • Third you need to clear your browser cache and check in private window your code definetely works.
    • Regarding date replace your the_date(); to: echo get_the_date('F j, Y'); it will works
    • last but most important point is make sure your check everything on single post page only.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体