Avada 테마 검색결과 페이지 타이틀을 바꾸고 싶어요.

안녕하세요, Avada를 통해 홈페이지를 만들고 있는 사람입니다.

현재 검색을 하게 되면 Search results for: 검색단어 이렇게 나오는데요.

제가 원하는건

---------

통합검색결과

'검색단어'를 검색한 결과입니다.

-----------

이렇게 나오는 것입니다.

 

functions.php 로 컨트롤 하고 싶은데요

 

기존 테마의 코드는

 

--------

 

if ( ! function_exists( 'avada_get_page_title_bar_contents' ) ) {
    /**
     * Get the contents of the title bar.
     *
     * @param  int  $post_id               The post ID.
     * @param  bool $get_secondary_content Determine if we want secondary content.
     * @return array
     */
    function avada_get_page_title_bar_contents( $post_id, $get_secondary_content = true ) {

        if ( $get_secondary_content ) {
            ob_start();

            if ( 'breadcrumbs' === fusion_get_option( 'page_title_bar_bs' ) ) {
                fusion_breadcrumbs();
            } elseif ( 'search_box' === fusion_get_option( 'page_title_bar_bs' ) ) {
                get_search_form();
            }
            $secondary_content = ob_get_contents();
            ob_get_clean();
        } else {
            $secondary_content = '';
        }

        $title                       = '';
        $subtitle                    = '';
        $page_title_custom_text      = get_post_meta( $post_id, 'pyre_page_title_custom_text', true );
        $page_title_custom_subheader = get_post_meta( $post_id, 'pyre_page_title_custom_subheader', true );
        $page_title_text             = fusion_get_option( 'page_title_bar_text' );

        if ( ! empty( $page_title_custom_text ) ) {
            $title = $page_title_custom_text;
        }

        if ( ! empty( $page_title_custom_subheader ) ) {
            $subtitle = $page_title_custom_subheader;
        }

        if ( is_search() ) {
            /* translators: The search query. */
            $title    = sprintf( esc_html__( 'Search results for: %s', 'Avada' ), get_search_query() );
            $subtitle = '';
        }

        if ( is_search() ) {
            /* translators: The search query. */
            $title    = sprintf( esc_html__('통합검색결과'));
            $subtitle = sprintf( esc_html__( '"%s"를 검색한 결과입니다.'), get_search_query() );
        }

이렇게 바꾸면 되긴 하는데 테마 업데이트 될때마다 수정을 해야 할 것 같아서요..

        if ( ! $title ) {
            $title = get_the_title( $post_id );

            // Only assign blog title theme option to default blog page and not posts page.
            if ( is_home() && 'page' !== get_option( 'show_on_front' ) ) {
                $title = Avada()->settings->get( 'blog_title' );
            }

            if ( is_404() ) {
                $title = esc_html__( 'Error 404 Page', 'Avada' );
            }

            if ( class_exists( 'Tribe__Events__Main' ) && ( ( Avada_Helper::tribe_is_event( $post_id ) && ! is_single() && ! is_home() && ! is_tag() ) || Avada_Helper::is_events_archive( $post_id ) && ! is_tag() || ( Avada_Helper::is_events_archive( $post_id ) && is_404() ) ) ) {
                $title = tribe_get_events_title();
            } elseif ( is_archive() && ! Avada_Helper::is_bbpress() && ! is_search() ) {
                if ( is_day() ) {
                    /* translators: Date. */
                    $title = sprintf( esc_html__( 'Daily Archives: %s', 'Avada' ), '<span>' . get_the_date() . '</span>' );
                } elseif ( is_month() ) {
                    /* translators: Date. */
                    $title = sprintf( esc_html__( 'Monthly Archives: %s', 'Avada' ), '<span>' . get_the_date( 'F Y' ) . '</span>' );
                } elseif ( is_year() ) {
                    /* translators: Date. */
                    $title = sprintf( esc_html__( 'Yearly Archives: %s', 'Avada' ), '<span> ' . get_the_date( 'Y' ) . '</span>' );
                } elseif ( is_author() ) {
                    $curauth = get_user_by( 'id', get_query_var( 'author' ) );
                    $title   = $curauth->nickname;
                } elseif ( is_post_type_archive() ) {
                    $title = post_type_archive_title( '', false );

                    $sermon_settings = get_option( 'wpfc_options' );
                    if ( is_array( $sermon_settings ) ) {
                        $title = $sermon_settings['archive_title'];
                    }
                } else {
                    $title = single_cat_title( '', false );
                }
            } elseif ( class_exists( 'bbPress' ) && Avada_Helper::is_bbpress() && Avada_Helper::bbp_is_forum_archive() ) {
                $title = post_type_archive_title( '', false );
            }

            if ( class_exists( 'WooCommerce' ) && Avada_Helper::is_woocommerce() && ( is_product() || is_shop() ) && ! is_search() ) {
                if ( ! is_product() ) {
                    $title = woocommerce_page_title( false );
                }
            }
        }

        // Only assign blog subtitle theme option to default blog page and not posts page.
        if ( ! $subtitle && is_home() && 'page' !== get_option( 'show_on_front' ) ) {
            $subtitle = Avada()->settings->get( 'blog_subtitle' );
        }

        if ( 'hide' !== fusion_get_option( 'page_title_bar' ) && ! $page_title_text ) {
            $title    = '';
            $subtitle = '';
        }

        return apply_filters( 'avada_page_title_bar_contents', [ $title, $subtitle, $secondary_content ] );
    }
}

 

------

 

이런식으로 되어 있습니다.

워드프레스 filter 고수님의 조언 부탁드립니다.

좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기
워드프레스 에러 기술지원 서비스 전문가에게 맡기세요
워드프레스 에러 기술지원 서비스 전문가에게 맡기세요