Tyler Brady
Tyler Brady

Reputation: 119

Issue with date when integrating latest wordpress blog post into site using php

I want to preface this with saying that my php knowledge is very novice and I am currently learning my way around the language via wordpress.

The problem: I have a website where I'm integrating their 3 latest blog posts from wordpress into their footer. I have everything working fine except the date.

Here's the snippet for my date:

<div class="col-lg-2">
  <div class="col-lg-12">
    <h4><?php the_date('d'); ?></h4>
  </div>
  <div class="col-lg-12">
    <h4><?php the_date('M'); ?></h4>
  </div>
</div>

What I'm attempting to do is have the day and the month on two separate rows in html with the date on top of the month.

When viewing this live it is only showing me the day for the particular snippet above, however, if I remove the php code the day it will then show the month.

Its like it can only show one or the other and not both at the same time.

I'm sure there is something fundamental that I'm missing here.

Any help on what is happening and how to correct the issue would be greatly appreciated!

Upvotes: 0

Views: 24

Answers (1)

Sajan
Sajan

Reputation: 81

You should try using get_the_date function instead. https://jonnyjordan.com/blog/the_date-function-wordpress-shows-once-first-post/

Upvotes: 1

Related Questions