Mana Mana - 1 month ago 10
PHP Question

WordPress code changes not taking place

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

I have figured out that editing the

single.php
file 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.

Answer

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.