Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $posts = $wpdb->get_results ( "SELECT ID, post_content, post_title FROM {$wpdb->posts} WHERE post_status != 'inherit' AND post_type IN ('post','page') ORDER BY ID $orderby" );
- if ( $limit > 0 )
- $sql .= $wpdb->prepare( " LIMIT %d,%d", $offset, $limit );
- if (count ($posts) > 0)
- {
- foreach ($posts AS $post)
- {
- if (($matches = $this->matches ($pattern, $post->post_content, $post->ID)))
- {
- foreach ($matches AS $match)
- $match->title = $post->post_title;
- $results = array_merge ($results, $matches);
- }
- }
- }
- /*
- from http://wordpress.org/support/topic/limit-to-doesnt-work http://daisukeblog.com/?p=2149 change to /path/to/wordpress/wp-conent/plugins/search-regex/searches/post_content.php
- */
- $posts = $wpdb->get_results ( $wpdb->prepare("SELECT ID, post_content, post_title FROM {$wpdb->posts} WHERE post_status != 'inherit' AND post_type IN ('post','page') ORDER BY ID $orderby") );
- if (count ($posts) > 0)
- {
- $hit = 0;
- foreach ($posts AS $post)
- {
- if (($matches = $this->matches ($pattern, $post->post_content, $post->ID)))
- {
- ++$hit;
- foreach ($matches AS $match)
- $match->title = $post->post_title;
- $results = array_merge ($results, $matches);
- }
- if($limit>0&&$hit>=$limit)
- {
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement