A while back i posted a simple function that gets latest post in a certain category:
function get_lastest_post_of_category($cat){
$args = array( 'posts_per_page' => 1, 'order'=> 'DESC', 'orderby' => 'date', 'category__in' => (array)$cat);
$post_is = get_posts( $args );
return $post_is[0]->ID;
}
So once you have that function you can use use WP_Query or query_posts and using the post__not_in parameter you can exclude that post, so something like:
query_posts(array(`post__not_in` => array(get_lastest_post_of_category($CAT_ID))));
just change $CAT_ID to the actual category id
Related Posts:
- Keep featured content post in homepage with original order
- How to get posts published between a date and today?
- How to show related posts by category
- Query posts distinct authors
- How to get previous 10 days post from a specific date – WP Query
- Number of posts per page setting is not working?
- Can’t show comments count per post outside loop
- Order post by year DESC and month ASC
- Featured Posts for Category Pages
- Cannot Update A Post, 404 Error
- Function to show random posts from a category
- Hiding posts in a list from specified categories
- Filter Posts By Tag
- Improving WP_Query for performance when random posts are ordered
- Inserting custom data to the_post() during loop
- How To Get Posts With A Specific Word
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Why is querying posts messing up my pages?
- Display all posts that were published before full post on single.php
- Blog post per page setting conflicting with custom WP_Query?
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- Random ajax load only works with posts_per_page set to -1
- Display an author’s posts on his own author page
- Multi row post list
- How to make multiple sections in home pulling posts category wise?
- wp_posts table: safely remove unused columns to save database storage
- Query Posts by Custom Field
- Order posts alphabetically: how to set order=asc in mysql query?
- How to order posts in an arbitrary order?
- How to get posts from a current post’s month?
- Wrong post title displayed from loop
- WordPress query_posts by tag doesn’t work anymore(?)
- While loop articles – if statement order
- do more action after I publish a post
- Retrieve only posts from a specific user in wp-admin/edit.php
- Conditionals if tags exist?
- WordPress website loads more posts than expected
- Get the amount of posts on a current page
- Posts – display all posts except a post by an ID
- query post limits
- why the same code got different results when using query_posts in functions.php and index.php
- Display Posts with template on a Page
- Archive template combined with post slider and regular posts
- How to get posts published on the latest date?
- How to only publish posts with image in it
- How to check in functions.php if there is data in a WP_Query?
- Shortcode with ‘year’ parameter
- Post Filtering by GET URL parameters
- On what hook can I get the queried object’s final state?
- Get the most recently modified post date of most recently modified post
- WP_Query: Show 10 posts in date order, first three random
- Get post by tag
- Random posts that always include a particular post?
- Bootsrap carousel for post
- All categories displays the same posts
- Query function not executed between element [closed]
- Echo the number of posts being displayed
- Exclude a category of posts in author template
- Display specific posts on home page
- WordPress displays post on subcategory only
- WP_Query articles order by offset in collumns
- Trying to query all posts in category 4
- Getting posts from some categories plus some individual posts
- Get posts from current category?
- Change content off every sixth element
- Move position in post list for a custom checkbox column
- How to merge the content of posts that have the same title?
- get posts, run a custom query, and join the results
- Show posts from two specific category in WP_Query
- How to create loop of posts except post ID defined via ACF field
- Displaying all posts from other sites on the network on one site
- Multisite how to display merged posts from two sites and sort by latest date?
- How to display particular categorie’s post which associated to specific user?
- wp_query args with relation
- Querying posts from current category, using a variable as array argument
- How to correctly escape data
- Use special template for the first post in the loop
- Blog posts not displaying on blog posts page
- Repeating post how to solve this
- Sort Events by Venue Title – Sort Post set by related post ids
- Need help writing loop to display posts by categories in separate divs
- Get posts by category or author
- Query post category & remove any post id
- show latest authors blog post
- How to get only current images of a post
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- How to pass multiple checkbox values to wordpress query?
- How to limit the number of results for all query_posts on mysite
- How to get all post titles starting with numbers and symbols?
- How to inject a post within a loop
- How to get alphabetic listing x other posts, based on first letter post?
- wp_query select if have comments
- Creating pages and getting their values from the database table
- How to limit post query to only return a total count of items with certain post statuses?
- Not displaying any articles on a custom made file
- query_posts different amount of posts per page [duplicate]
- Sort Posts Alphabetically Based on Specific Category (Divi)
- How to change url of posts?
- How to show related posts by detecting the current category?
- Display posts on a custom page from only a specific category?