Title: Special PHP code for category and the plugin
Last modified: August 30, 2016

---

# Special PHP code for category and the plugin

 *  [flyingunknown](https://wordpress.org/support/users/flyingunknown/)
 * (@flyingunknown)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/special-php-code-for-category-and-the-plugin/)
 * Hello,
 * I used the plugin q translate X for my website, and it works very well, I’m really
   happy, but I’ve a problem.
    I used a PHP code found on a site to have sidebars/
   widgets for categories, but it doesn’t work of the english version of the categories.(
   Nothing appears at left for the english version of the categories)
 * Here my code (in the sidebar.php) : `<?php
 * /**
 *  * The Sidebar containing the main widget areas.
 *  *
 *  * [@package](https://wordpress.org/support/users/package/) sparkling
 *  */
 * ?>
 * </div>
 *  <div id=”secondary” class=”widget-area col-sm-12 col-md-4″ role=”complementary”
   >
 *  <div class=”well”>
 *  <?php do_action( ‘before_sidebar’ );
 * if ( is_category() ) {
 * $sidebar_id = ( is_category() ) ? sanitize_title( get_cat_name( get_query_var(‘
   cat’ ) ) ) . ‘-sidebar’ : ‘sidebar’;
 * dynamic_sidebar( $sidebar_id );
 * }
 * elseif ( ! dynamic_sidebar( ‘sidebar-1’ ) ) { ?>
 *  <aside id=”search” class=”widget widget_search”>
 *  <?php get_search_form(); ?>
 *  </aside>
 *  <aside id=”archives” class=”widget”>
 *  <h3 class=”widget-title”><?php _e( ‘Archives’, ‘sparkling’ ); ?></h3>
 *  <ul>
 *  <?php wp_get_archives( array( ‘type’ => ‘monthly’ ) ); ?>
 *  </ul>
 *  </aside>
 *  <aside id=”meta” class=”widget”>
 *  <h3 class=”widget-title”><?php _e( ‘Meta’, ‘sparkling’ ); ?></h3>
 *  <ul>
 *  <?php wp_register(); ?>
 *  <li><?php wp_loginout(); ?></li>
 *  <?php wp_meta(); ?>
 *  </ul>
 *  </aside>
 *  <?php
 *  }
 *  ?>
 *  </div>
 *  </div><!– #secondary –>
    `
 * Do you have an idea of what I’ve to do ?
    Thank you very much.
 * [https://wordpress.org/plugins/qtranslate-x/](https://wordpress.org/plugins/qtranslate-x/)

The topic ‘Special PHP code for category and the plugin’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/qtranslate-x_f9f9f9.svg)
 * [qTranslate X](https://wordpress.org/plugins/qtranslate-x/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/qtranslate-x/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/qtranslate-x/)
 * [Active Topics](https://wordpress.org/support/plugin/qtranslate-x/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/qtranslate-x/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/qtranslate-x/reviews/)

## Tags

 * [categories](https://wordpress.org/support/topic-tag/categories/)
 * [sidebar](https://wordpress.org/support/topic-tag/sidebar/)

 * 0 replies
 * 1 participant
 * Last reply from: [flyingunknown](https://wordpress.org/support/users/flyingunknown/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/special-php-code-for-category-and-the-plugin/)
 * Status: not a support question