SOLUTION:
I added
$titles = array();
at the top (outside the loop).
Then, within the loop, I used
array_push( $titles, get_the_title( $ID ) );
to collect the titles.
Then I just checked the array for a matching title before displaying, like this:
if ( !in_array(get_the_title( $ID ), $titles ) )
...then do this
And it works!
Related Posts:
- Inject post (from specific category) between posts in Loop
- Strange switch_to_blog() issue
- How can I add extra word in permalink when someone click download button?
- remove post that has no content
- Count posts on multisite with blog id
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Show recent posts starting at a specific number archive
- WordPress query undefined offset in loop
- Find Site ID From WP_Post
- Only show first image in foreach loop
- Do not duplicate posts with multiple categories in multiple loops
- How to pick “full/thumbnail” images in the loop?
- Wp Query : Order by distance lat,lon
- Display articles with a different template in the home page | Solved |
- Is there anyway I can call the year once?
- WordPress recent post
- How do if all posts has this category ID then do this
- Get current_post in reverse order with pagination
- Add div after every 4 posts then every 2 posts for a responsive loop
- Insert div after every three posts in home.php [duplicate]
- Automatically create a loop for post ID
- Excerpt all post content Content Same Size without word cutting off
- How to create a loop that will display one post and stop?
- How to use a conditional statement in a post loop but not count towards the “posts_per_page” if false
- Count the number of matching post names in foreach loop
- Custom theme on multisite has issues with standard loop output
- Custom php page outside the scope of my theme
- How to get 2 or multiple custom post types in wordpress functions.php
- “before delete post” action fire when the post is updated?
- Use wp_get_recent_posts with search term
- multiple if statements [closed]
- How to select WooCommerce products by post_meta and order them
- Displaying a button on each post
- Trying to make php run in a post
- Hide post if matches current month and year
- How can I add pagination and how can I change thumbnail size?
- Creating bulk posts with Youtube videos
- How to Display a Single Post Excerpt
- WordPress (3.9.1) MultiSite Permissions. Is chown the answer?
- have_posts() execution failure
- How does the ternary operator work in the wordpress loop post?
- Remove posts after a given amount of time
- $wpdb->flush(); breaks the loop
- Adding hreflang tags automatically in WordPress subdirectory multisite
- Automatically add custom CSS to new posts using a category template
- Use object in template part
- How Display Posts on category
- Hide wordpress field if data is empty in post!
- How can I use wp_query to show all product data using just the products ID?
- Query all posts of a custom taxonomy term
- Retrieving Author ID in wp-admin area
- Get first URL from post content
- How can I add multiple ‘tax_query’ arrays via a loop?
- ACF page while loop breaks footer while loop
- How to add values to media “whitelist_options” in wp-admin/options.php template?
- Getting a specific post values to another div or modal
- Trying to add attribute to my posts’ featured image
- Displaying the last post on static homepage
- Using foreach loop breaks
- Cannot display or echo alt text on featured image
- Using Advanced Custom Fields to create a per page slider
- Split loop into two columns, how to favor one side over the other
- Can’t get wp_insert_post to work
- Why not yield/iterable in posts interface?
- WordPress Search Results for Multiple Post Types
- Recent posts with featured image or fallback image with permalink
- Best practice for migration friendly images in posts/pages?
- Changing layout with wp_customise
- How to change home or site url using action hooks or filter?
- Display post category in foreach loop with category link
- How to show part of the_content?
- Dynamic Stylesheet loads but doesn’t finish
- Filter Select results based on selection
- Using loop pagination on single.php
- Recent Posts slider, using WP_Query(), loads duplicate sliders
- Why WP_Query(‘showposts=5’) shows only 1 post?
- I would like to have different styles for my posts based on the content of each post
- Loop with slider (slider not loading)
- How to hide all child pages with post_query?
- How to sort posts based on the value (number) of a post’s metadata?
- Show css depending on activity type in BuddyPress activity-loop [closed]
- Unreadable pagination
- 200 Rewrite blog post links
- How to set a min number of words for a blog post
- Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?
- wordpress media library new uploads don’t write to database
- Loop through categories and display posts title under each dropdown
- Get post id in a function when edit/add a post
- how do I get a specific post from a post with a subcategory in WP
- Automatically create child pages and grandchild pages when saving a (parent) page
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- How do I exclude recent post from recent post php widget
- Second transition_post_status hook fired instead of the first
- Iterate through posts based on array of categories
- get author_name from queried post
- WordPress returning 404 for multisite pages
- Displaying Woocommerce Product Category in WordPress
- How to call plugin function per site in a multisite?
- How to store post ID’s in cookie or session to display the same posts later
- WordPress returns “The link you followed has expired” error page whenever I add a new site, add a user etc