Title: [Plugin: Promotion Slider] getting category variable in hard code
Last modified: August 20, 2016

---

# [Plugin: Promotion Slider] getting category variable in hard code

 *  Resolved [lfer](https://wordpress.org/support/users/lfer/)
 * (@lfer)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-promotion-slider-getting-category-variable-in-hard-code/)
 * Hello people.
    I’m using this hardcode im my “Purity Theme” to call “Promotion-
   Slider” in my “single-portfolio.php” template:
 * > <?php echo do_shortcode(‘[promoslider category=”rings” width=”662px” height
   > =”441px”]’); ?>
 * But, it’s a jewelry site and I have others categories to show like necklaces,
   earrings, bracelets, etc. So, I can’t put just one category name in my hardcode.
   I need to put a variable to get the right images from category that users chosen,
   so my code looks like this example:
 * > <?php echo do_shortcode(‘[promoslider category=”GET_PROMO-SLIDER_CATEGORY” 
   > width=”662px” height=”441px”]’); ?>
 * I’m not a programmer and don’t know how to do this. Could anyone show me a way
   to get the right categorry chosen by the user.
 * Thanks a lot.
 * Luis Fernando
 * [http://wordpress.org/extend/plugins/promotion-slider/](http://wordpress.org/extend/plugins/promotion-slider/)
 * _[ Please do not bump, it’s [not permitted here](http://codex.wordpress.org/Forum_Welcome#No_Bumping).]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Micah Wood](https://wordpress.org/support/users/woodent/)
 * (@woodent)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-promotion-slider-getting-category-variable-in-hard-code/#post-2727361)
 * [@lfer](https://wordpress.org/support/users/lfer/),
 * Here is some code that will pull the current category and display the appropriate
   slider:
 *     ```
       <?php
           if( is_category() ) {
           	    $catID = get_query_var('cat');
       	    $cat = get_category( $catID );
       	    $shortcode = '[promoslider category="'.$cat->slug.'" width="662px" height="441px"]';
       	    echo do_shortcode( $shortcode );
           }
       ?>
       ```
   
 *  Thread Starter [lfer](https://wordpress.org/support/users/lfer/)
 * (@lfer)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-promotion-slider-getting-category-variable-in-hard-code/#post-2727366)
 * Hello Micah.
    Thank you very much for your help, but I can’t make it work yet.
   Look the page [http://www.cicloweb.com.br/site_clientes/test_fe/produtos/](http://www.cicloweb.com.br/site_clientes/test_fe/produtos/)
   and try to click in “Rings” category to go to single portfolio page. No images
   are show.
 * I create a user and password for you acess WP-Admin area. If you can help me 
   I apreciate a lot. I sent the username and password for your e-mail.
 * Thanks
    Luis Fernando
 *  Plugin Author [Micah Wood](https://wordpress.org/support/users/woodent/)
 * (@woodent)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-promotion-slider-getting-category-variable-in-hard-code/#post-2727373)
 * [@lfer](https://wordpress.org/support/users/lfer/),
 * You are actually trying to link a specific post type to the promotion categories.
   The code I gave you above isn’t working because you aren’t actually on a category
   page.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: Promotion Slider] getting category variable in hard code’ is
closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/promotion-slider.svg)
 * [Promotion Slider](https://wordpress.org/plugins/promotion-slider/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/promotion-slider/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/promotion-slider/)
 * [Active Topics](https://wordpress.org/support/plugin/promotion-slider/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/promotion-slider/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/promotion-slider/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Micah Wood](https://wordpress.org/support/users/woodent/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-promotion-slider-getting-category-variable-in-hard-code/#post-2727373)
 * Status: resolved