Plugin Directory

Changeset 2802381


Ignore:
Timestamp:
10/21/2022 10:58:05 AM (3 years ago)
Author:
sitetran
Message:

Many improvements. International website users can now use the search input to search your site in any language you add to SiteTran.

Location:
sitetran
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sitetran/trunk/includes/sitetran-front.php

    r2801471 r2802381  
    513513    }
    514514
     515    // We make multilingual search work
     516    function SITETRAN_search_form_modify($input) {
     517     
     518      // Only execute if it's search form
     519      if ( is_search() && isset($_GET['s'])) {
     520
     521        if ( isset($_COOKIE['sitetran_lang']) ) { // Only execute if sitetran_lang cookie is found
     522          $sitetran_original_language_code = get_option('sitetran_original_language_code');
     523          $user_selected_lang = $_COOKIE['sitetran_lang'];
     524          $search_query = $_GET['s'];
     525   
     526          // If sitetran_lang cookie is same as default language then return
     527          if ( $user_selected_lang == $sitetran_original_language_code ) {
     528            return $input;
     529          }
     530   
     531          global $wpdb;
     532          $sitetran_pages = $wpdb->prefix.'sitetran_pages';
     533          $sitetran_page_to_lang = $wpdb->prefix.'sitetran_page_to_lang';
     534         
     535          // We get translated posts based on translated search query and language code
     536          $input = "SELECT SQL_CALC_FOUND_ROWS wp_posts.*
     537          FROM wp_posts
     538          JOIN $sitetran_pages sp
     539          ON sp.post_id = wp_posts.ID
     540          JOIN $sitetran_page_to_lang sptl
     541          ON sptl.page_id = sp.page_id
     542          AND sptl.page_body LIKE CONCAT('%', '$search_query', '%')
     543          AND sptl.language_code = '$user_selected_lang'
     544          WHERE (
     545            (wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish'))
     546            OR (wp_posts.post_type = 'page' AND (wp_posts.post_status = 'publish'))
     547            OR (wp_posts.post_type = 'attachment' AND (wp_posts.post_status = 'publish'))
     548            OR (wp_posts.post_type = 'product' AND (wp_posts.post_status = 'publish'))
     549          )
     550          ORDER BY wp_posts.post_title DESC, wp_posts.post_date DESC LIMIT 0, 10";
     551        }
     552           
     553        remove_filter('posts_request','my_posts_request_filter');
     554      }
     555
     556      return $input;
     557    }
    515558
    516559    // When page loads this function is called
     
    522565      if(!empty($sitetran_authentication_key) ) {
    523566        add_action('wp_footer', array($this, 'SITETRAN_footer_language_switcher_callback'));
     567        add_filter('posts_request',array($this, 'SITETRAN_search_form_modify'));
    524568      }
    525569
  • sitetran/trunk/readme.txt

    r2801484 r2802381  
    1818SiteTran enables you and your team to work together to translate everything on your WordPress site in a way that is efficient, straightforward, and consistent.
    1919
    20 The plugin adds the SiteTran Widget, a language dropdown, to every page of your site, allowing your website's users to change languages.
    21 
    22 Easily get your phrases added to SiteTran. You can use Google Translate or DeepL, and you can also invite your team members to translate or manage the translation process for you, entirely in SiteTran's powerful interface.
    23 
    24 SiteTran handles duplicate content for you, across your entire site. You won't waste time or money translating the same thing again and again.
    25 
    26 Start with our free forever version. If you go over your free usage, you only pay for what you use; no monthly plans!
     20The plugin adds the SiteTran Widget, a language dropdown, to every page of your site that enables your website's users to change languages.
     21
     22Easily get your phrases added to SiteTran. You can use Google Translate or DeepL, and you can also invite your team members to translate or manage the translation process for you, entirely in SiteTran's interface.
     23
     24SiteTran handles duplicate content for you, across your site. You won't waste time or money translating the same thing twice.
     25
     26Start with our free forever version. If you go above your free usage, only pay for what you use; no monthly plans!
    2727
    2828With inexpensive and scalable [usage based pricing](https://www.sitetran.com/pricing#calculator), SiteTran is for everyone.
     
    3232* Easier to use than alternatives
    3333* Less expensive
     34* Built for WordPress
    3435* Time-saving
    3536* Great at facilitating teamwork
     
    4142**SiteTran + WordPress Features**
    4243
    43 * ✅ **Fully customizable widget:** Make the language dropdown look and feel however you want.
    44 * ✅ **No coding needed:** Get up and running easily within minutes. Our software will enable you to  handle all special translation cases.
     44* ✅ **We Don't Interfere:** SiteTran doesn't modify your WordPress interface or duplicate your posts. Your international SEO will be amazing!
     45* ✅ **Fully Customizable Sidget:** Make the language dropdown look and feel however you want.
     46* ✅ **No Coding Needed:** Get up and running easily within minutes. Our software will enable you to  handle all special translation cases.
    4547* ✅ **Customer Support:** Speedy customer support that actually cares about you.
    46 * ✅ **100% fully SEO optimized:** Get on every search engine in every language. Great for organic traffic. You can translate metadata, and we automatically add hreflang tags and the global lang HTML attribute to pages for you.
     48* ✅ **SEO Booster:** Get on every search engine - in every language. Great for organic traffic. You can translate metadata, and we automatically add hreflang tags and the global lang HTML attribute to pages for you.
    4749* ✅ **Search Engine Friendly URLs:** We create URLs with your language codes as subdirectories (example.com/**es**/). Search engines will index all of your translated pages.
    48 * ✅ **Works with every theme and all plugins:** Translate every possible element, including content generated by other plugins.
    49 * ✅ **Unified process:** A single interface to manage everything from. Create and update your translations directly on SiteTran.
    50 * ✅ **WooCommerce:** Easily translate your WooCommerce store.
     50* ✅ **Works With Every Theme and all Plugins:** Translate every possible element, including content generated by other plugins.
     51* ✅ **Unified Process:** A single interface to manage everything from. Create and update your translations directly on SiteTran.
     52* ✅ **Translate WooCommerce:** Easily translate your WooCommerce products.
     53* ✅ **Translate Search:** Use the default WordPress search to find translated posts or WooCommerce products.
    5154* ✅ **Competitive Pricing:** We cost less than the rest. You only pay for what you use if you exceed your free monthly usage.
    5255
Note: See TracChangeset for help on using the changeset viewer.