Currently, I have the following code that hooks when the date is displayed. I want this to code to effect dates on listed posts (index.php) and a single post.
function rating_after_date()
{
return printf(
'Ratings: %s'
,get_post_meta( get_the_ID(), 'post_rating', true )
);
}
add_action( 'get_the_date', 'rating_after_date' );
It changes the date but not the way I want it to:
Ratings: 0Ratings: 010
I would like the posts to the display the date like:
March 22, 2016 | Rating: <somenumber>
Thanks for any help.
That filter takes in parameter the date, date format and post id.
You could do something like this :
Mote that you should adjust the priority of your new filter so that it executes at the end of the stack.
Here is a good example : https://codex.wordpress.org/Plugin_API/Filter_Reference/get_the_date