Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #282396

    rikclaessens
    Participant

    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!

    #282421

    Nico
    Moderator

    Hi There,

    Would you mind sharing us your URL so we could take a closer look on your setup.

    Thanks.

    #282824

    rikclaessens
    Participant

    Thanks 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’

    #282864

    Paul R
    Moderator

    Hi,

    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.

    #283417

    rikclaessens
    Participant

    Works perfectly, thanks for the quick help!

    #283678

    Lely
    Moderator

    You’re welcome.

    Cheers!
    X