پرش به محتویات

"Filter: bricks/get_the_title"

عنوان صفحه بازگردانده شده توسط Helpers::get_the_title() را فیلتر می‌کند. این تابع بر اساس زمینه (تک پست، آرشیو، نتایج جستجو و غیره) عنوان مناسب را تعیین می‌کند.

پارامترها

  • $title (string): The generated page title.
  • $post_id (int): The ID of the current post or template.

نمونه استفاده

add_filter( 'bricks/get_the_title', function( $title, $post_id ) {
    // Example: Add a prefix to the title for search results
    if ( is_search() ) {
        return 'Searching: ' . $title;
    }

    return $title;
}, 10, 2 );