WordPress.org

Ready to get started?Download WordPress

Forums

ComicPress
[resolved] Body tag editing (2 posts)

  1. Corsair66
    Member
    Posted 5 months ago #

    I need to insert this comment before the </body> tag on my site's main page:

    <!-- Last Update: <?php echo date("d/m/Y"); ?> -->

    The idea is to auto-update the date whenever a new comic is posted.

    Which file must be edited to insert this comment? I've looked without success; I must've passed right over it - any assistance would be greatly appreciated!

    Thanks...

    Ken

  2. Frumph
    Member
    Theme Author

    Posted 3 months ago #

    add_action('wp-head', 'mytheme_last_update');
    
    function mytheme_last_update() {
        if (is_home() || is_front_page()) {
             echo '<!-- Last Update: '.date("d/m/Y").' -->'."\r\n";
        }
    }

    Add that to your child themes functions.php file or your main themes functions.php file

    ..but that will post the current date, though.. not the one of the latest comic.. if you want latest comic; would need to write a loop for you to get that info

Reply

You must log in to post.

About this Theme

About this Topic