Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1046867
    genuinesp
    Participant

    Hi!

    I want to activate 3 languages in my site: spanish, english and french.

    Only spanish language will have a BLOG.

    I’ve seen that, when I use the search field, the results appear in a template with a right sidebar with widgets that I’ve selected. This is OK to spanish because in this language we have a blog, and the widgets of the sidebar are relationated with blog, but it’s not OK to english and french because these languages don’t have blog activate.

    It’s possible to show a template with sidebar if language is spanish and template without sidebar if language is english or french?

    Thanks a lot!

    #1046871
    genuinesp
    Participant
    This reply has been marked as private.
    #1047004
    Paul R
    Moderator

    Hi,

    To achieve that, you can add this in your child theme’s functions.php file.
    wp-content/themes/x-child/functions.php

    
    function x_get_content_layout() {
    
        $content_layout = x_get_option( 'x_layout_content' );
    
        if ( $content_layout != 'full-width' ) {
          if ( is_home() ) {
            $opt    = x_get_option( 'x_blog_layout' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( is_singular( 'post' ) ) {
            $meta   = get_post_meta( get_the_ID(), '_x_post_layout', true );
            $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout;
          } elseif ( x_is_portfolio_item() ) {
            $layout = 'full-width';
          } elseif ( x_is_portfolio() ) {
            $meta   = get_post_meta( get_the_ID(), '_x_portfolio_layout', true );
            $layout = ( $meta == 'sidebar' ) ? $content_layout : $meta;
          } elseif ( is_page_template( 'template-layout-content-sidebar.php' ) ) {
            $layout = 'content-sidebar';
          } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) {
            $layout = 'sidebar-content';
          } elseif ( is_page_template( 'template-layout-full-width.php' ) ) {
            $layout = 'full-width';
          } elseif ( is_archive() ) {
            if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) {
              $opt    = x_get_option( 'x_woocommerce_shop_layout_content' );
              $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
            } else {
              $opt    = x_get_option( 'x_archive_layout' );
              $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
            }
          } elseif ( x_is_product() ) {
            $layout = 'full-width';
          } elseif ( x_is_bbpress() ) {
            $opt    = x_get_option( 'x_bbpress_layout_content' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( x_is_buddypress() ) {
            $opt    = x_get_option( 'x_buddypress_layout_content' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( is_404() ) {
            $layout = 'full-width';
          } else {
            $layout = $content_layout;
          }
        } else {
          $layout = $content_layout;
        }
    
        if( (get_locale() == "en_US" ||  get_locale() == "fr_FR") && is_search()) {
            $layout = 'full-width';
        }
        return $layout;
    
      }
    

    Hope that helps.

  • <script> jQuery(function($){ $("#no-reply-1046867 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>