Show only oldest post by author

To restrict users to just one post, don’t let them create new posts. Just add one wp_editor() instance to their profile. Hook into ‘show_user_profile’ and ‘edit_user_profile’ to show the editor. Hook into ‘personal_options_update’ and ‘edit_user_profile_update’ to save the content to a user meta or a hidden custom post type. Now they don’t have to search … Read more

How to create a WP_Query to search the Title or Tag?

Please use below code to show posts in texonomy and titles $s = $request[‘s’]; $tags = str_replace(‘ ‘, ‘-‘, strtolower($request[‘s’])); $q1 = get_posts(array( ‘fields’ => ‘id’, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘s’ => $s )); $q2 = get_posts(array( ‘fields’ => ‘ids’, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘tag’ … Read more

Order Posts by Closest Numeric Values

One possibility is a direct SQL query similar to the one given here. But I’m not convinced that it would be much more efficient than 2 queries, all handled by WordPress: The is untested $price =0; //Price of current property $id=0; //Property (post) ID. $args = array( ‘post_type’ => ‘property’, ‘post__not_in’=>array($id), ‘posts_per_page’=> 2, ‘meta_query’ => … Read more

BP Multi Network & Members Directory [closed]

You can filter the members loop in BuddyPress by meta values for the members. So you would need to change the loop in the template file members/members-loop.php to be: <?php // Getting current blog_id global $wpdb, $current_blog; $id = $current_blog->blog_id; // Setting variable for current blog_prefix $blog_prefix = $wpdb->get_blog_prefix( $id ); // Start the BuddyPress … Read more