Reputation: 25
I know I can change the color and size of the date within a single entry page via css that's already in place but how can I format the individual items within the get_the_date call?
Right now if I use ('j M. Y')
I will get "26 Nov. 2014" on one line. I want to be able to have this display as:
As you can see, the date is on a line by itself and is larger than the Mon. Year line.
The page that I am editing is template_tags.php and the line that I am editing is
esc_html( get_the_date('j M. Y') )
Any help is appreciated.
Upvotes: 0
Views: 8921
Reputation: 71
<?php echo esc_html(get_the_date( 'j' )); ?> <br />
<?php echo esc_html(get_the_date("M. Y")); ?>
Upvotes: 0
Reputation: 25
Wound up doing:
'<div align="center" style="display:block"><span id="da1"> '. esc_html( get_the_date( 'j' ) ). '</span><br><span style="font-size:10px;display:block;">'.esc_html( get_the_date( 'M. Y' ) ) . '</span>')
No echo needed
Thanks everyone!
Upvotes: 0
Reputation: 6828
You can use the template tag twice:
echo '<span class="date_1">' . esc_html( get_the_date( 'j' ) ) . '</span>';
echo '<span class="date_2">' . esc_html( get_the_date( 'M. Y' ) ) . '</span>';
Upvotes: 2
Reputation: 27102
Break it up into different items. For example:
echo '<div class="day">' . esc_html( get_the_date("j") ) . '</div>';
echo '<div class="month-year">' . esc_html( get_the_date("M. Y") ) . '</div>';
You can then target each of these <div>
s via their CSS class names.
Upvotes: 2