Title: Shortcode doesn&#039;t work
Last modified: September 2, 2016

---

# Shortcode doesn't work

 *  [Treebeard](https://wordpress.org/support/users/malawimama/)
 * (@malawimama)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-1/)
 * I followed the instructions by adding the code to my template file:
 *     ```
       <?php add_shortcode('cleanprint_print_button', 'get_cleanprint_print_button');
           function get_cleanprint_print_button() {
              if( function_exists('cleanprint_add_print_button') ){
                 return cleanprint_add_print_button();
              }
           }
       ?>
       ```
   
 * and the shortcode to the page I want the buttons on:
 * `[cleanprint_print_button]`
 * but the page just shows the shortcode as it appears in the editor, no buttons.
   The buttons appear if I active ALL PAGES to have the buttons, but I only want
   1 page to have the buttons.

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

 *  Plugin Author [johncadams](https://wordpress.org/support/users/johncadams/)
 * (@johncadams)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-1/#post-7724825)
 * If added to functions.php file you should not need to wrap the code in a php 
   header, (<?php … ?>) the functions.php file usually has already declared it.
 * Also make sure you are running WP 2.5 or later.
 *  Thread Starter [Treebeard](https://wordpress.org/support/users/malawimama/)
 * (@malawimama)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-1/#post-7724828)
 * As you can see above, it is wrapped in a php header. But why would I add it to
   functions.php? I didn’t see that in the documentation anywhere. I added the code
   to the template within the loop, right above the_content, like this:
 *     ```
       <?php add_shortcode('cleanprint_print_button', 'get_cleanprint_print_button');
           function get_cleanprint_print_button() {
              if( function_exists('cleanprint_add_print_button') ){
                 return cleanprint_add_print_button();
              }
           }
       ?>
   
       <?php the_content(); ?>
       ```
   
 * I thought that’s what you were supposed to do, I didn’t see any documentation
   about it. If I added it to the functions file, then where would that button go?
   I need to place it where I want it, not on all pages, only on the 1 page, so 
   that’s why I added it to the template file I created for this page.
 * Running 3.4.2…
 *  Plugin Author [johncadams](https://wordpress.org/support/users/johncadams/)
 * (@johncadams)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-1/#post-7724830)
 * Normally the functions.php file starts the php syntax (look at the top of the
   file) and never closes it. Therefore you don’t add the php delimiters and simply
   append the code to the bottom.
 *  Thread Starter [Treebeard](https://wordpress.org/support/users/malawimama/)
 * (@malawimama)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-1/#post-7724831)
 * I just didn’t realize the code was supposed to be in the functions file. Do you
   know how to show a print button only on a specific template?
 *  Plugin Author [johncadams](https://wordpress.org/support/users/johncadams/)
 * (@johncadams)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-1/#post-7724832)
 * I suppose if you moved the code to the template file (without <?php ) that is
   included by functions.php that may work (give it a try). This is really a general
   shortcode question and nothing specific to CleanPrint.
 *  Plugin Author [johncadams](https://wordpress.org/support/users/johncadams/)
 * (@johncadams)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-1/#post-7724833)
 * BTW this topic isn’t a review and should move to the support forum.
 *  Thread Starter [Treebeard](https://wordpress.org/support/users/malawimama/)
 * (@malawimama)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-1/#post-7724836)
 * Yea I know right! That was really weird, when I clicked on a rating, it automatically
   took me to that page and I didn’t realize it was a Reviews tab (was really late),
   so just started typing out my question. I apologize, I don’t know how to move
   it though. Maybe it can be deleted? I checked here, and there’s no option to 
   delete a review once it’s posted (that I can see).
 * Anyway, I already tried the template php. Normally that works, but that’s why
   I posted the question, because it’s not working.

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

The topic ‘Shortcode doesn't work’ is closed to new replies.

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

 * 7 replies
 * 2 participants
 * Last reply from: [Treebeard](https://wordpress.org/support/users/malawimama/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-1/#post-7724836)