• Resolved Sophie Cheng

    (@sopala)


    First of all, thank you for the wonderful plugin. I have a problem relating to feature images.

    The images on my webpages are not shown when the webpage is switched from default language version (Traditional Chinese) to another language (English). I have checked with the Inspector of Chrome. It shows no errors but the html code of img “src” is disappeared when switched to English version. The images display normally in Chinese version.

    Here are the two webpages I am having difficulties with (the language switcher is on the right sidebar):
    Homepage
    https://gtr-arbor.com.hk/en/
    Latest News (blog page)
    https://gtr-arbor.com.hk/en/category/news/

    On both pages, the images are auto-generated by the theme. For example, on the blog page, the thumbnail is the featured picture of the post.

    Here is the code of the “latest news” blog template

    <?php get_header();?>
    
          <?php
            global $post;
            $page_slideshow_type = get_post_meta($post->ID,"_page_slideshow_type",true);
            $slideshow_cat = get_post_meta($post->ID,"_page_slideshow_category",true);
            $blog_page = get_option('ecobiz_blog_page');
            $blog_page_id = get_page_by_title($blog_page);
            $heading_image = get_post_meta($blog_page_id->ID,"_heading_image",true);
            $page_short_desc = get_post_meta($blog_page_id->ID,"_page_short_desc",true);
            $slideshow_order = get_option('ecobiz_slideshow_order') ? get_option('ecobiz_slideshow_order') : "date";
          ?>
          <?php if ($page_slideshow_type =="" || !isset($page_slideshow_type) || $page_slideshow_type == "None" ) { ?>
            <!-- Page Heading -->
            <div id="page-heading">
              <img src="<?php echo $heading_image ? $heading_image : get_template_directory_uri().'/images/page-heading.jpg';?>" alt="" />
              <div class="heading-text<?php if ($bgtext_heading_position =="right") echo '-right';?>">
                <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
             	  <?php /* If this is a category archive */ if (is_category()) { ?>
            		<h3><?php single_cat_title(); ?></h3>
             	  <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
            		<h3><?php single_tag_title(); ?></h3>
             	  <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
            		<h3><?php echo __('Archive for ','ecobiz');?><?php the_time('F jS, Y'); ?></h3>
             	  <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
            		<h3><?php echo __('Archive for ','ecobiz');?><?php the_time('F, Y'); ?></h3>
             	  <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
            		<h3><?php echo __('Archive for','ecobiz');?> <?php the_time('Y'); ?></h3>
            	  <?php /* If this is an author archive */ } elseif (is_author()) { ?>
            		<h3><?php echo __('Author Archive','ecobiz');?></h3>
             	  <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
            		<h3><?php echo __('Archives','ecobiz');?></h3>
             	  <?php } ?>
              </div>
            </div>
            <!-- Page Heading End -->
          <?php } else { ?>
            <?php
            if ($page_slideshow_type !="None"  || $page_slideshow_type == "Nivo slider" || $page_slideshow_type == "Kwicks slider") {
              if ($page_slideshow_type == "Nivo slider") {
                get_nivoslider($slideshow_cat,$slideshow_order);
              } else if ($page_slideshow_type == "Kwicks slider") {
                get_kwicksslider($slideshow_cat,$slideshow_order);
              }
            }
            ?>
          <?php } ?>  
    
          <div class="clear"></div>
    
          <div class="center">
            <?php $enable_breadcrumbs = get_option('ecobiz_enable_breadcrumb');?>
            <?php if ($enable_breadcrumbs =="true") { ?>
              <div class="breadcrumb">
                <?php if ( function_exists( 'breadcrumbs_plus' ) ) breadcrumbs_plus(); ?>
              </div>
            <?php } ?>
            <!-- Main Content Wrapper -->
            <div class="maincontent">
            <!-- List Latest News Start //-->
            <ul id="listlatestnews">
            <?php
              $blog_cats_include = get_option('ecobiz_blog_categories');
              if(is_array($blog_cats_include)) {
                $blog_include = implode(",",$blog_cats_include);
              } 
    
              $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
              $blog_items_num = (get_option('ecobiz_blog_items_num')) ? get_option('ecobiz_blog_items_num') : 5;
              $blog_order = (get_option('ecobiz_blog_order')) ? get_option('ecobiz_blog_order')  : "date";
              $blog_text_num = (get_option('ecobiz_blog_text_num')) ? get_option('ecobiz_blog_text_num') : 75;
    
              while ( have_posts() ) : the_post();
              $thumb   = get_post_thumbnail_id();
              $img_url = wp_get_attachment_url( $thumb,'full' ); //get full URL to image (use "large" or "medium" if the images too big)
              $image   = aq_resize( $img_url, 150, 150, true ); //resize & crop the image
    
              ?>
              <li>
                <div class="boximg-blog">
                <?php if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {?>
                  <div class="blogimage">
                    <a href="<?php the_permalink();?>"><img src="<?php echo $image;?>" alt="" class="boximg-pad" /></a>
                  </div>
                <?php } ?>
                </div>
                <div class="postbox">
                <h3><a href="<?php the_permalink();?>"><?php the_title();?></a></h3>
                <p><?php echo excerpt($blog_text_num);?></p>
               </div>
               <div class="clear"></div>
                <div class="metapost">
                  <span class="first"><?php echo __('[:en]Post at [:zh]分佈於[:]','ecobiz');?>: <?php the_time( get_option('date_format') ); ?></span> |
                  <span><?php echo __('[:en]By[:zh]撰文[:]','ecobiz');?> : <?php the_author_posts_link();?></span>  |
                  <span><?php echo __('[:en]Category[:zh]分類[:]','ecobiz');?>: <?php the_category(',');?></span>  |
                  <span><?php comments_popup_link(__('[:en]0 Comment[:zh]0 篇留言[:]','ecobiz'),__('[:en]1 Comment[:zh]1 篇留言[:]','ecobiz'),__('[:en]% Comments[:zh]% 篇留言[:]','ecobiz'));?></span>
                </div>
                <div class="clear"></div>
              </li>
              <?php endwhile;?>
              </ul>
              <div class="clear"></div>
              <?php
                global $wp_query;
                $total_pages = $wp_query->max_num_pages;
                if ( $total_pages > 1 ) {
                if (function_exists("wpapi_pagination")) {
                    wpapi_pagination($total_pages);
                  }
                }
              ?>
            </div>
            <!-- Main Content Wrapper End -->
    
            <?php wp_reset_query();?>
            <?php get_sidebar();?>
    
      <?php get_footer();?>

    Thank you!

    https://www.ads-software.com/plugins/qtranslate-x/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Feature Images not shown when switched to other languages’ is closed to new replies.