Follow us on

Codestar Support Forum » WordPress Plugins » Codestar Framework

Using With Multilang website

  1. Thanks alot for a great framework

    i want to know how to use with qtranslate-xt plugin , i used it before with old free version

    how to use it now

    thanks alot

    Posted 1 year ago #

  2. Codestar
    Admin

    Hi,

    Welcome to support forum and thanks for purchasing.

    Yes, I removed that feature in v2 because there are problems with group, repeater and complex fields. I moved to use global multilangual methods. i.e wpml-config.xml

    QTranslate is outdated plugin. I highly recommended WPML and Polylang (free) plugins. These are using wpml-config.xml idea. If still you need to QTranslate there is some solution. Follow these steps:

    Add a custom css styles to your css file.

    .csf-field-en{
      display: none;
    }
    
    .csf-field-de{
      display: none;
    }
    
    .edrress-lang-en .csf-field-en{
      display: block;
    }
    
    .edrress-lang-de .csf-field-de{
      display: block;
    }CopyCopied!

    Add the admin body class filter to your utils functions

    function edrress_admin_body_class( $classes ) {
    
      if ( function_exists( 'qtranxf_getLanguage' ) ) {
        $classes = 'edrress-lang-'.qtranxf_getLanguage();
      }
    
      return $classes;
    }CopyCopied!

    Add a get_option function to your utils functions

    function edrress_get_option( $option = '', $default = null ) {
    
      $options = get_option( 'YOUR_FRAMEWORK_ID' );
    
      $multilang_option = 'en'; // default language
    
      if ( function_exists( 'qtranxf_getLanguage' ) ) {
        $multilang_option = $option .'-'. qtranxf_getLanguage();
      }
    
      if ( $multilang_option && isset( $options[ $multilang_option ] ) && $options[ $multilang_option ] !== '' ) {
        return $options[ $multilang_option ];
      } else if ( isset( $options[ $option ] ) && $options[ $option ] !== '' ) {
        return $options[$option];
      } else {
        return $default;
      }
    
    }CopyCopied!

    Set the config like this.

    array(
      'id'    => 'opt-text-en',
      'type'  => 'text',
      'title' => 'Text English',
      'class' => 'csf-field-en',
    ),
    
    array(
      'id'    => 'opt-text-de',
      'type'  => 'text',
      'title' => 'Text Deutsch',
      'class' => 'csf-field-de',
    ),CopyCopied!

    The final, let's use it in frontend.

    echo edrress_get_option( 'opt-text' );CopyCopied!

    Yea, This idea is similar like v1 of framework.

    Another way is simply only type this to text field. [:en]English Text[:de]Deutsch[:] but yes, it's difficult for clients.

    Regards, Codestar

    Posted 1 year ago #
  3. thanks alot

    ill try it

    Posted 1 year ago #

  4. Codestar
    Admin

    You're welcome

    Posted 1 year ago #