title: Wordpress is generating Undefined variable:post in function.php
body: <p>My wordpress site was working fine. I did not change anything, but today morning it just showing an error about which i have no clue why its showing like this and how to solve is. The errors i am getting: </p>
  
  <ol>
  <li><p>Notice: Undefined variable: post in /home/afch1ealth1/public_html/wp-content/themes/afc/functions.php on line 154.</p></li>
  <li><p>Notice: Undefined property: stdClass::$post_date in /home/afch1ealth1/public_html/wp-includes/query.php on line 4582.</p></li>
  </ol>
  
  <p>And in function.php on line 154 i have used the below codes:</p>
  
  <pre><code>&lt;?php 
  
      function excerpt($num) {
  
      $limit = $num+1;
      $excerpt = explode(' ', get_the_excerpt(), $limit);
      array_pop($excerpt);
      $excerpt = implode(" ", $excerpt)."&lt;a href='".get_permalink($post-&gt;ID)."'class='".readmore."'&gt; [Read More]&lt;/a&gt;"; &lt;-------- this is exact 154 line
  
      echo $excerpt;
  
      }
     ?&gt;
  </code></pre>
  
  <p>Though i am getting this errors, but my wordpress is working perfectly.</p>
  
  <p>I have attach a image here for your better understanding.</p>