$new_output = astra_get_post_meta($post_meta, \" <i class='fa fa-calendar'><\/i>\");<\/code><\/pre>\n\n\n\nRemember, whatever you put in as the separator will be the separator for each of the elements of the post meta. If you have more elements than what I have here, it could look a little weird.<\/p>\n\n\n\n
If you want to have multiple, individual Font Awesome icons in the post meta, you'll have to rewrite astra_get_post_meta()<\/em>, which you can find inastra\/inc\/blog\/blog-config.php<\/em>.<\/p>\n\n\n\nThe code above will only change the post meta on single posts. If you want to change the formatting on category pages, use this code as well or instead:<\/p>\n\n\n\n
add_filter('astra_blog_post_meta', 'custom_blog_meta');\nfunction custom_blog_meta($old_meta)\n{\n $post_meta = astra_get_option('blog-meta');\n if (!$post_meta) return $old_meta;\n \n $new_output = astra_get_post_meta($post_meta, \":\");\n if (!$new_output) return $old_meta;\n \n return \"<div class='entry-meta'>$new_output<\/div>\";\n}<\/code><\/pre>\n\n\n\nHow To Display \"Last Modified\" Date<\/h2>\n\n\n\n Sometimes you want to display the Last Modified or Last Updated date in your post meta. You might want to do this instead of the Published Date or as well as it.<\/p>\n\n\n\n
How do you display the \"Last Modified\" date in Astra? The \"Last Modified\" date is already in the html of the post meta. All you need to do is unhide it with CSS. Put this code into your custom CSS:<\/strong><\/p>\n\n\n\n.post .posted-on .updated {\n display: inline;\n}<\/code><\/pre>\n\n\n\nTo hide the Published Date, put this code into your custom CSS:<\/p>\n\n\n\n
.post .posted-on .published {\n\tdisplay: none;\n}<\/code><\/pre>\n\n\n\nHow To Modify The Post Meta Date<\/h2>\n\n\n\n Lastly, the whole reason I went down this particular rabbit hole was to figure out how to modify the post meta date with my own text. I wanted something that looked like this:<\/p>\n\n\n\n
<\/figure><\/div>\n\n\n\nHow do you modify the post meta date in Astra? Replicate astra_post_date()<\/em>, add your own text or formatting and return the output<\/strong>.<\/p>\n\n\n\nTo get the post meta looking the way it is in this picture, I used the following code, in combination with the filters and CSS mentioned above:<\/p>\n\n\n\n
\/* Replaces same named function in \/inc\/blog\/blog-config.php *\/\nfunction astra_post_date()\n{\n $format = apply_filters('astra_post_date_format', '');\n $published = esc_html(get_the_date($format));\n $modified = esc_html(get_the_modified_date($format));\n\n $output = '<p class=\"posted-on\">';\n $output .= 'Published: <span class=\"published\" ';\n $output .= 'itemprop=\"datePublished\">' . $published;\n $output .= '<\/span><br>';\n $output .= 'Last Modified: <span class=\"updated\" ';\n $output .= 'itemprop=\"dateModified\">' . $modified . '<\/span>';\n $output .= '<\/p>';\n \n return apply_filters('astra_post_date', $output);\n}<\/code><\/pre>\n\n\n\nYou put that code in your functions.php<\/em> file of your child theme<\/a>.<\/p>\n\n\n\nI broke up the $output<\/em> lines for ease of reading in this tutorial. Change it to suit your code.<\/p>\n\n\n\nPlay around with that code to get it looking the way you want. It should be pretty clear what each part does. If you get stuck, just comment below and I'll help you out.<\/p>\n","protected":false},"excerpt":{"rendered":"
Astra is a popular WordPress theme, that I use on many of my sites. It’s lightweight and looks great, but sometimes you just want to customize it more than it normally allows. Thankfully it has plenty of hooks. By default, the post meta in Astra looks like this: How to customize the post meta in<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[19],"yoast_head":"\n
How To Customize The Post Meta In Astra<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n