Avoid removing duplicate posts

It’s a bit less efficient, but if you have an array of IDs, possibly including duplicates, and want to get the posts for each, I’d suggest use get_post() on each ID, giving you an array of posts. $post_ids = [ 24, 11, 60, 11 ]; $posts = array_map( ‘get_post’, $post_ids ); global $post; foreach ( … Read more

cURL needing to loop through all “next_page”

You could try something like: $url=”https://oc.com/api/v1/employees/?page=1″; $data = array(); while ( $url ) { $response = $this->request( $url ); $data = array_merge( $data, $response->data ); // if this is not the last page, get the next page URL if ( $response->paginator->current_page != $response->paginator->last_page ) { $url = $response->paginator->next_page; } else {$url = false;} } return … Read more

Add Search and Filter functionality to custom loop

You must create a different search form for your post type, so that search results can be displayed according to post type. You can add this to your search form <input type=”hidden” name=”post_type” value=”meetup_groups”> Example : <form method=”get” id=”my-custom-searchform” action=”<?php echo esc_url(home_url( “https://wordpress.stackexchange.com/” )); ?>”> <input type=”text” value=”<?php the_search_query(); ?>” name=”s” id=”s” placeholder=”<?php echo esc_attr__( … Read more