I'm using the query_post modified code to display modified post I'm just wondering is there a way to ignore or hide unmodified post?
I'm using the query_post modified code to display modified post I'm just wondering is there a way to ignore or hide unmodified post?
Something like this in a 'normal' loop:
if ($post->post_date != $post->post_modified) {
//display your modified posts
}
[edit]
well it works for the most part except i can't control the amount of post that show up in the page because it seems to be counting non editted post as well any to control that show ignores the noneditted post from the post count?
That would be true. To make pagination work, you'd have to do something like this:
<?php
function filter_where($where = '') {
$where .= " AND post_date != post_modified ";
return $where;
}
add_filter('posts_where', 'filter_where');
query_posts($query_string);
?>
Didn't test this though. May need a remove_filter also.
this seems to only show updated post that are still on the frontpage and doesn't show any updated post that aren't on the front page.
May need to put remove_filter('posts_where', 'filter_where'); after the query.
okay it didn't change it, all the modified post seem to go by the original date and not the modified date and its messing up the updated order. So older post don't show up on the modified page.
Just so I can test this, what template (e.g. index.php, archives.php} are you putting the code in and where are you seeing the problem? I'll be using the WordPress Default theme.
I'm putting it in the index code and I'm seeing the problem in the order it doesn't seem to be in modified order.
Works okay for me--note that sticky posts will be included.
The SQL that generates is this:
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') AND post_date != post_modified ORDER BY wp_posts.post_date DESC LIMIT 0, 5
it works but it won't stick post that aren't already showing on the first page to the first post updated on the modified page. So they don't really update in order they update but the newest update doesn't go to the top of the page so the order for the modified page is post added and not post modified order.
Not too sure about that but maybe try the 'caller_get_posts'=>1 or 'caller_get_posts'=>0 argument with your query.
Good Luck.
sorry i just edited my post so its clearer the post order isn't using post modified order is what i meant.
Okay well maybe someone else can jump in with a different solution.
Recently Updated Posts plugin seems to do it properly but I'm not sure what part of the code does the order and I can't edit it well enough to fit my needs.
This topic has another possibility but you would need to to change http://wordpress.org/support/topic/337645
post_modified_gmt != post_date_gmt
to
post_modified_gmt = post_date_gmtI'm trying to get the post order so it is ordered by post_modified_gmt instead of post_date_gmt so I'm not sure how making them equal would do any good but than I only know the very basics of php, the link you gave me does seem to work but it seems alot more difficult to modify and all i need my current code to do is be able to go by modified order instead of the default order.
This topic has been closed to new replies.