-
AuthorPosts
-
May 26, 2015 at 3:27 pm #282396
Hi,
How can I put a small text ‘Last updated: DD-MM-YYYY’ in the footer, where the date DD-MM-YYYY is updated automatically, according to the date of latest changes to any of the pages on the website? So just one date on all of the subpages and the homepage.
Thanks alot!
May 26, 2015 at 4:06 pm #282421Hi There,
Would you mind sharing us your URL so we could take a closer look on your setup.
Thanks.
May 27, 2015 at 6:16 am #282824Thanks for the quick reply.
Our URL is (temporarily): http://khd.rikclaessens.nl/
On the bottom, there’s already a placeholder in Dutch: ‘Laatste update: xx-xx-xxxx’
May 27, 2015 at 7:01 am #282864Hi,
You can add this in your child theme’s functions.php
function site_last_updated($d = '') { $recent = new WP_Query("showposts=1&orderby=modified&post_status=publish&post_type=any"); if ( $recent->have_posts() ) { while ( $recent->have_posts() ) { $recent->the_post(); $last_update = get_the_modified_date($d); } echo $last_update; } else echo 'No posts.'; }
Then create file wp-footer.php in wp-content/themes/x-child/framework/views/ethos and copy the code below into that file
<?php // ============================================================================= // VIEWS/ETHOS/WP-FOOTER.PHP // ----------------------------------------------------------------------------- // Footer output for Ethos. // ============================================================================= ?> <?php x_get_view( 'global', '_header', 'widget-areas' ); ?> <?php x_get_view( 'global', '_footer', 'scroll-top' ); ?> <?php x_get_view( 'global', '_footer', 'widget-areas' ); ?> <?php if ( x_get_option( 'x_footer_bottom_display', '1' ) == '1' ) : ?> <footer class="x-colophon bottom" role="contentinfo"> <div class="x-container max width"> <?php if ( x_get_option( 'x_footer_content_display', '1' ) == '1' ) : ?> <div class="x-colophon-content"> <?php echo x_get_option( 'x_footer_content' ); ?> </div> <?php endif; ?> <div class="last-updated"><?php echo site_last_updated('') ?></div> <?php if ( x_get_option( 'x_footer_menu_display', '1' ) == '1' ) : ?> <?php x_get_view( 'global', '_nav', 'footer' ); ?> <?php endif; ?> <?php if ( x_get_option( 'x_footer_social_display', '1' ) == '1' ) : ?> <?php x_social_global(); ?> <?php endif; ?> </div> </footer> <?php endif; ?> <?php x_get_view( 'global', '_footer' ); ?>
After that add the code below in custom > css box in the customizer.
.x-colophon.bottom .last-updated { display:block; clear:both; float:none; overflow:hidden; text-align:center; }
Hope that helps.
May 27, 2015 at 4:24 pm #283417Works perfectly, thanks for the quick help!
May 27, 2015 at 7:34 pm #283678You’re welcome.
Cheers!
X -
AuthorPosts