• Resolved Houdini

    (@romariokg)


    I am trying TranslatePress at the moment. I translated some listing to test my search bar.

    Searching for listing with the main language (Kyrgyz) works, but searching for listing with the secondary language added with TranslatePress (Russian) doesn’t work.

    I looked up this forum and I couldn’t find any useful directions.
    I also made sure that “Disable post container tags for post title” and “Disable post container tags for post content” are not checked.

    Search code PHP:

        <?php if ( ! empty( RDTheme::$options['listing_search_items']['keyword'] ) ): ?>
            <div class="<?php echo esc_attr( $key_class ); ?>">
                <div class="form-group">
                    <div class="rtcl-search-input-button rtin-keyword">
                        <input type="text" data-type="listing" name="q" class="rtcl-autocomplete"
                               placeholder="<?php echo esc_html( $keyword_placeholder ); ?>"
                               value="<?php if ( isset( $_GET['q'] ) ) {
                                   echo esc_attr( Functions::clean( wp_unslash( ( $_GET['q'] ) ) ) );
                               } ?>"/>
                    </div>
                </div>
            </div>
        <?php endif; ?>


    any suggestions?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Cristian Antohe

    (@sareiodata)

    Hello,

    You can use WP_Query with the query[‘s’] parameter and it will work out-of-the-box to provide relevant posts for that key term.

    The key term needs to be in same language as the current language being displayed when loading that page. In code, posts returned will be in the default language (IDs, post title, post content etc.) but the content echoed is translated on a later hook, so it will be displayed in the translated language in front-end.

    Only post title and post content are searchable in translated languages, external custom fields such as ACF are not. Depending on your setup, if you can include custom fields content inside the_content hook, then the custom fields are searchable as well.

    For the search to work on a specific post in a specific language, translation of that post content and title in that same language must exist prior to searching. If automatic translation is active, a post must be visited at least once in that specific language in order to get indexed by TP.

    Let me know if this helps with the search.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.