Title: Problems with adding shortcode
Last modified: August 21, 2016

---

# Problems with adding shortcode

 *  [shootingtime](https://wordpress.org/support/users/shootingtime/)
 * (@shootingtime)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problems-with-adding-shortcode/)
 * I’m trying to add shortcodes for my adsense ads and am experiencing problems.
   Here is the code that I am adding to the functions.php of my Child Theme.
 *     ```
       function google_adsense1() {
           return '<script type="text/javascript"><!--
       google_ad_client = "<em>your client id</em>";
       google_ad_slot = "<em>your ad slot id</em>";
       google_ad_width = <em>width</em>;
       google_ad_height = <em>height</em>;
       //-->
       </script>
       <script type="text/javascript"
       src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
       </script>
       ';
       }  
   
       add_shortcode('adsense1', 'google_adsense1');
       ```
   
 * Of course I am replacing what I need to with my ads information. When I add the[
   adsense1] to the text view of my page and update, the screen goes white. Normal
   functioning of my dashboard will not resume until I delete the functions.php 
   on the remote server.
 * What am I doing wrong here?
 * Thanks!
    Corey

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

 *  Thread Starter [shootingtime](https://wordpress.org/support/users/shootingtime/)
 * (@shootingtime)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problems-with-adding-shortcode/#post-4299726)
 * I am using the Expound theme and my url is [http://shootingtime.com](http://shootingtime.com)
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problems-with-adding-shortcode/#post-4299729)
 * That is not the way to handle a script in WordPress. You should be using [wp_enqueue_script(](http://codex.wordpress.org/Function_Reference/wp_enqueue_script))
   with the `$in_footer` parameter.
 *  Thread Starter [shootingtime](https://wordpress.org/support/users/shootingtime/)
 * (@shootingtime)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problems-with-adding-shortcode/#post-4299739)
 * I’ll look into that. Thanks.
 *  Thread Starter [shootingtime](https://wordpress.org/support/users/shootingtime/)
 * (@shootingtime)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problems-with-adding-shortcode/#post-4299744)
 * I will place a shortcode in my pages where necessary. Could you give me an example
   of what the finished functions.php code should look like? The page you linked
   looks a little complicated for me. I of course will continue to research.
 * This looks a little contradictory.
 * $in_footer
    (boolean) (optional) Normally, scripts are placed in <head> of the
   HTML document. If this parameter is true, the script is placed before the </body
   > end tag. This requires the theme to have the wp_footer() template tag in the
   appropriate place. Default: false
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problems-with-adding-shortcode/#post-4299761)
 * > This looks a little contradictory.
 * Sorry? What part are you having a problem with?
 *  Thread Starter [shootingtime](https://wordpress.org/support/users/shootingtime/)
 * (@shootingtime)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problems-with-adding-shortcode/#post-4299798)
 * I just got confused with it saying the scripts are placed in the head.
 * Esmi, prior to September 27th, I thought wordpress was a place that made newspapers,
   lol. I understand quite a bit now but am trying to figure out how I can implement
   adsense shortcode successfully without a plugin.
 * I understand the suggested method you provided will probably work, but I lack
   the knowledge to understand how. From what I know, all I would have to do is 
   add the proper coding to the functions.php of my child theme. I attempted that
   after some research and came up with the error.
 * Is there a way you could spoon feed me how I should do it? I installed a shortcode
   plugin which works. I then looked through the files on the server for how they
   coded it, but couldn’t find it.
 * Thanks for your help esmi.
 * Corey

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

The topic ‘Problems with adding shortcode’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [shootingtime](https://wordpress.org/support/users/shootingtime/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/problems-with-adding-shortcode/#post-4299798)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
