I want to dynamically display Last Date Date and time in a title in Wordpress. Please help me with the code that I can get the last published time and date from the WP database and get it on my Header.php or Somewhere else (HTML). Thank.
This code can be used to get the latest date and time message in header.php
<?php echo get_lastpostdate(); ?>
Here is the function link https://codex.wordpress.org/Function_Reference/get_lastpostdate
You can use wp_get_recent_posts()to get the last message:
wp_get_recent_posts()
$recent_posts = wp_get_recent_posts( array( 'numberposts' => '1' ) ); echo $recent_posts[0]['post_date'];
Source: https://habr.com/ru/post/1663890/More articles:How to Set Seaside 3.2 Session Timeouts (Age) - smalltalkMultiple K8S containers connecting to Google Cloud SQL through a proxy server - kubernetesGoogle Analytics на AMP не отправляет пользовательские параметры - google-analyticsJenkins multi-line shell with control character - jenkinsHow to fix "CoffeeScript not defined" template error - ruby | fooobar.comиспользование Jenkins2 для загрузки через FTP - jenkinsHow to use USBmakebmRequestType in fast - objective-cExecuting operations in parallel while saving in order, incremental output - javaJava 8 thread processing is not irrevocable - javaFailed to start IIS Express in Visual Studio 2017 RC - c #All Articles