| @@ -843,8 +843,9 @@ | ||
| 843 | 843 | private function find_keyword_positions(string $content, string $keyword): array { |
| 844 | 844 | $positions = []; |
| 845 | 845 | $offset = 0; |
| 846 | 846 | |
| 847 | + // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition -- the canonical strpos() scan loop; hoisting it needs a duplicated call. | |
| 847 | 848 | while (($pos = strpos($content, $keyword, $offset)) !== false) { |
| 848 | 849 | $positions[] = $pos; |
| 849 | 850 | $offset = $pos + 1; |
| 850 | 851 | } |
| @@ -943,9 +944,9 @@ | ||
| 943 | 944 | // Get recent posts for blog homepage |
| 944 | 945 | $recent_posts = get_posts(['numberposts' => 3]); |
| 945 | 946 | $content_parts = []; |
| 946 | 947 | foreach ($recent_posts as $post) { |
| 947 | - $content_parts[] = $post->post_title . ' ' . wp_trim_words($post->post_content, 100); | |
| 948 | + $content_parts[] = $post->post_title . ' ' . \ThinkRank\Core\Seo_Text::trim_words($post->post_content, 100, '...', 1000); | |
| 948 | 949 | } |
| 949 | 950 | $content = implode(' ', $content_parts); |
| 950 | 951 | } |
| 951 | 952 | break; |