if ($wp_query->current_post +1 == $wp_query->post_count) {
// this is the last post
}
Change $wp_query to your own query variable if you made a new WP_Query object.
Related Posts:
- Where is the old post permalink slug stored?
- Keyboard shortcut for updating a page or post?
- How to Change Order of Posts in Admin?
- Do we still need to include a “if (have_posts())” in templates?
- How to display the page title/content in the Posts page?
- blog posts sorting doesnt work while using get_query_var
- RSS for Pages Instead of Posts?
- Updating a post without escaping ampersands?
- Add javascript when post is published
- Automatic Delete post on a specific date
- Blog posts permalinks correct but recent post widgets goes to my website and not staying on my blog site
- One comment per user email per post
- meta_box or custom_field as a second tinymce post-instance?
- Cannot access current post’s ID in custom plugin
- Set number of article per number of page
- Create A Metabox For A Custom Field
- Show a list of recently viewed posts to a user
- Possible to create a permalink to sort with meta_key?
- Single Post Gallery Using Shortcode
- Get how many days since last post of the current user
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- Does an action fire when adding a tag via the “Tags” meta box?
- how load content as pop-up using ajax
- UberMenu list current user’s posts as menu items
- Improving WP_Query for performance when random posts are ordered
- Action hook for new pending posts?
- How to make the post summary taller?
- Why content_arr[‘extended’] removes paragraph tags?
- How To Get Posts With A Specific Word
- Getting index.php instead single.php for displaying posts
- Changing Permalinks for Default Post type to reflect navigation
- Using permalinks, category slugs, and tag slugs
- How to prevent duplicate posts with wp_insert_post on single.php?
- How to insert 2 args into 1 Wp_Query for a slideshow
- It is possible to add extra button under the ‘publish’ button in the post of wordpress? and how?
- How to have posts have a parent in permalink like site.com/blog/postname
- Second comments section for one post/page
- 404 error on default post type and default taxonomy fronted page
- How i can limit period of post publication?
- Internal post link creates comments on its own
- Disable link for single posts
- Can’t set Post ID properly
- Display post changelog in post
- Change post-slug using wordpress API? Change permalink of a post using php / jquery?
- Custom Post Type archive
- How to create a second posts page which client can update
- Form to post new post with custom taxonomies
- All Posts Linking to Author Posts directly
- search blog posts by author first name and or last name
- Make loop inside slider divisible [closed]
- How to add convenient buttons for new custom post statuses
- Change the number of excerpts displayed in search results layout
- Database hacked – random posts are modified
- Display value of custom field at the beginning of a post
- How to display post list in a table layout (multiple queries in single loop)
- add div after image in post [closed]
- Get current post’s nav menu name (term name)
- Get latest author posts inside the loop
- Post is in descendant category not working in home.php
- How to show 3 most recent/viewed posts in a special tiles on home page using wordpress?
- Get content from WordPress posts in Boostrap modal window – Javascript side?
- How can my plugin display a populated new post window
- Approve modified posts
- How to repeat a loop after 4 posts [duplicate]
- How to show beneath posts the full category path?
- User friendly news section in WordPress without using posts
- How to assign a post to a post parrent?
- Bulk update published posts date randomly using wp-cli?
- How to insert custom text after H1 to all my blog posts?
- SQL query: select duplicate posts – but using duplicate meta [duplicate]
- Sync All Post Type Tag
- Assign a day of the week to post, e.g: Assign Monday to post and have it only appear when the day is Monday
- Is it possible to query a category with specified posts?
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- how to redirect page after delete post inside a post page?
- Permalink base only for posts
- WordPress URL question
- issue in wordpress auto delete post and redirect to another 1
- Theme does not respect spaces between paragraphs in pages
- Custom fields in normal posts
- Modify WordPress loop after it has been run
- How to get next_posts_link working with a customised page
- exclude one child by id from $post->post_parent
- Ordering posts alphabetically by meta keys and title
- Loop doesn’t display posts. It displays a link to the home page instead
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Getting posts from multiple users?
- Super post cleaner, could this be category specific?
- WordPress Post Grid
- Why I getting only 1 post?
- Get current post’s child page?
- Choose options via url
- Custom Post Type Pagination 404 Error (if paged>=2) [duplicate]
- find view post hyperlink in PHP wordpress admin file
- Show all posts in category
- Creating a new Sortable Column in WordPress Admin
- Even/Odd every two posts
- Display post structure in function
- What function does the loop of displaying posts?
- WordPress + Polylang – Error 404 when trying to preview draft post on different language