@HoWin I’m still learning a lot about WordPress in Pinegrow, but here is how I did it.
For the year
- Place an
<h1>
where you want your Year to appear on the page - Select the element and add an If Option from the WordPress Actions
- For the condition enter
$old_year !== $current_year
- Next add a PHP Code block from the WP Actions
- For the function add
echo $current_year
and replace the Content - Add a PHP Code 2 block from the WP Actions
- For the function add
$old_year = $current_year
and for replace select Insert after
For the month
- Add an
<h2>
element where you want the month to appear - Select the element and add an If Option from the WP Actions
- For the condition enter
$old_month !== $current_month
- Next add a PHP Code block from the WP Actions
- For the function add
echo $current_month
and replace the Content - Add a PHP Code 2 block from the WP Actions
- For the function add
$old_month = $current_month
and for replace select Insert after
Set-up the variables
I added my variable initiation to the loop - you could probably also add them to the individual elements - thinking about it, that is how I should have done it, but I’m too lazy to go back and redo it!
- Select loop element
- Add a PHP Code block from the WP Actions
- For the function add
$current_year = get_the_date('Y')
and replace Insert before - Add a PHP Code 2 block from the WP Actions
- For the function add
$current_month = get_the_date('F')
and replace Insert before
That should do it! If you need additional help reach out.
Bob