Display
Display Class.
Namespace: WebberZone\Better_Search\Frontend
Since: 3.3.0
Source: includes/frontend/class-display.php line 22
Methods
__construct()
Constructor class.
Since: 3.3.0
Line: 29
public function __construct( );
enqueue_highlight_script() static
Enqueue the client-side highlight script on singular pages.
Covers full-page-cache scenarios (e.g. LiteSpeed) where PHP never runs, so server-side highlighting via HTTP_REFERER is skipped; this script reads document.referrer client-side instead. Only enqueued on singular views — search results are already handled server-side by content(), and archives/the homepage have no followed-link scenario to highlight.
Since: 4.3.2
Line: 50
static public function enqueue_highlight_script( ): void;
Returns: void
content()
Highlight search queries in the_content.
Since: 3.3.0
Line: 133
public function content( $content ): string;
| Type | Name | Description |
|---|---|---|
string |
$content |
Post content. |
Returns: string — Post Content
extract_highlight_terms() static
Extract the terms to highlight from a search query, keeping quoted phrases intact.
Double-quoted phrases are returned as single terms so the whole phrase is highlighted rather than its individual words. Terms prefixed with the exclusion operator (-) are skipped as they do not appear in the results.
Since: 4.3.2
Line: 166
static public function extract_highlight_terms( $search_query ): string[];
| Type | Name | Description |
|---|---|---|
string |
$search_query |
Search query. |
Returns: string[] — Terms and phrases to highlight.