I am just trying to find a way to style modified post and new post separately.

I have a site that have software for download, some software have new updates and I manage to bring updated post to main page with this code before my main loop:

<?php query_posts($query_string . '&orderby=modified&order=desc'); ?>                

I want to have different style for modified post.


Add a post class when the post modified time doesn't match publish time. Then style it with that class.

add_filter( 'post_class', 'wpse244651_add_modified_class' );

function wpse244651_add_modified_class( $classes ) {
    global $post;
    if( get_the_modified_time( $post->ID ) != get_the_time( $post->ID ) ) {
        $classes[] = 'modified-post';
    return $classes;
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.