couldnt show short code atts in category

Question

i add this shortcode in function :

function sub_about_movie( $atts , $content = null ) {
  $b = shortcode_atts(
    array(
      'name' => '',
      'time'  =>  '۹۲ دقیقه',
      'language' =>  'انگلیسی',
      'country' =>  'آمریکا',
      'director' =>  '',
      'writer' =>  '',
      'actor' =>  '',
      'age' =>  'pg-16',
      'imdb' =>  '929922893839489',
      'rate' =>  '6.4',
      'translator' =>  'سهراب طهماسب',
    ),
    $atts);
    global $sub_info_movie_name;
    $sub_info_movie_name=do_shortcode(esc_attr($b['name']));
    global $sub_movie_length;
    $sub_movie_length=do_shortcode(esc_attr($b['time']));
    global $sub_movie_language;
    $sub_movie_language=do_shortcode(esc_attr($b['language']));
    global $sub_movie_country;
    $sub_movie_country=do_shortcode(esc_attr($b['country']));
    global $sub_movie_director;
    $sub_movie_director=do_shortcode(esc_attr($b['director']));
    global $sub_movie_writer;
    $sub_movie_writer=do_shortcode(esc_attr($b['writer']));
    global $sub_movie_actor;
    $sub_movie_actor=do_shortcode(esc_attr($b['actor']));
    global $sub_movie_age;
    $sub_movie_age=do_shortcode(esc_attr($b['age']));
    global $sub_movie_imdb_link;
    $sub_movie_imdb_link=do_shortcode(esc_attr($b['imdb']));
    global $sub_movie_rate;
    $sub_movie_rate=do_shortcode(esc_attr($b['rate']));
    global $sub_movie_translators;
    $sub_movie_translators=do_shortcode(esc_attr($b['translator']));

}

and for example i use this code in single.php

  <?php
                                  global $sub_movie_country;
                                    echo $sub_movie_country;
                                   ?>

and it’s work true but when i use it in wordpress loop in category it don’t show any thing

0
amirreza kzm 3 months 0 Answers 11 views 0

Leave an answer