How to check if a post is published today?

You can use get_the_time() to get the date of the current post. Just use a format that only includes the year and date, and compare it to the current date using the current_time() function with the same format: if ( get_the_time( ‘Yd’ ) === current_time( ‘Yd’ ) ) { // Post was published today. }

Database hacked – random posts are modified

It’s possible that the random stuff is not in the database; your answer doesn’t make that clear. There could be some modified WP files that are inserting text in each displayed post. Recovering from a hacked system is time-consuming, but can be done. Short list: update WP/themes/plugins to latest versions. Check the htaccess file against … Read more

Incrementing PHP variable onclick to display posts by month

Try registering a function handling ajax calls first. // For logged out users add_action( ‘wp_ajax_nopriv_wp280265_pagination’, ‘wp280265_pagination’ ); // For logged in users add_action( ‘wp_ajax_wp280265_pagination’, ‘wp280265_pagination’ ); Define the function. function wp280265_pagination() { $month = $_POST[‘month’]; $year = $_POST[‘year’]; if ($month != ” && $year != ”) get_posts($month, $year); } Define JavaScript. (function($) { $(document.body).on(‘click’, ‘#previous’, … Read more

Deleting post specific content at beginning of post

Note that this filter function, added to the theme functions.php file, will apply to all output that uses “the_content” everywhere (all posts essentially) – so exercise or consider narrowing the scope. For instance, you might want to limit it to the first 100 characters, or to posts before a certain date, or within a certain … Read more

Post Title List on home page with time

In the main loop in index, to display the date like you are asking use: <?php printf( _x( ‘%s ago’, ‘%s = human-readable time difference’, ‘your-text-domain’ ), human_time_diff( get_comment_time( ‘U’ ), current_time( ‘timestamp’ ) ) ); ?> You can read more about it: https://codex.wordpress.org/Function_Reference/human_time_diff