Title: Shortcode insertion to extras.php help needed
Last modified: January 21, 2018

---

# Shortcode insertion to extras.php help needed

 *  Resolved [jonhs](https://wordpress.org/support/users/jonhs/)
 * (@jonhs)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/shortcode-insertion-to-extras-php-help-needed/)
 * My code starts like this in extras.php file:
 * // start code
 * function square_boxes_shortcode( $atts, $content = null ) {
 *  $ret = “<p>TEST</p>
 * SHARE BUTTON HERE!
 * <div class=’square-boxes’><div class=’square-boxes-wrapper’>”;
 * // end code
 * How do I insert share buttons shortcode where it says “SHARE BUTTONs HERE!”. 
   I need to use this shortcode: [addtoany buttons=”facebook,twitter”]
 * Thanks,
    Jon

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

 *  Plugin Author [micropat](https://wordpress.org/support/users/micropat/)
 * (@micropat)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/shortcode-insertion-to-extras-php-help-needed/#post-9887568)
 * Use the AddToAny template tag in PHP like:
 *     ```
       $ret = '<p>TEST</p>';
   
       if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) { 
           $ret .= ADDTOANY_SHARE_SAVE_KIT( array( 
               'buttons' => array( 'facebook', 'twitter' ),
               'output_later' => true,
           ) );
       }
   
       $ret .= '<div class="square-boxes"><div class="square-boxes-wrapper">';
       ```
   
 *  Thread Starter [jonhs](https://wordpress.org/support/users/jonhs/)
 * (@jonhs)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/shortcode-insertion-to-extras-php-help-needed/#post-9888220)
 * Thank you. Can you advice how to insert shortcode in the below code. See placement
   where it says “SHORTCODE HERE” here:
 *     ```
       function square_boxes_shortcode( $atts, $content = null ) {
   
         $ret = "<p>Text</p>
         <p>Text</p>
       <p><strong>Text</strong><br />
       <div class='btn-varaa'><a href='http://xxx'>Text</a></div>
       <br />
       text</p>
   
         <p><a href='http://xxx'>Text/a></p>
   
       INSERT SHORTCODE HERE
   
       <div class='square-boxes'><div class='square-boxes-wrapper'>";
   
         $k=0;
         while(the_repeater_field('square_boxes', 'options')) {
           $k++;
           $text = get_sub_field('text');
           $lines = 1;
           $lines += substr_count($text, "<br/>");
           $lines += substr_count($text, "<br />");
           $lines += substr_count($text, "<br >");
           $lines += substr_count($text, "<br>");
   
           $ret .= "<div class='square-box box-nth-".($k%3)."'><a href='".get_sub_field('link')."'><span class='text lines-count-".$lines."'>".$text."</span></a></div>";
         }
   
         $ret .= "<div class='clearer'></div></div></div>";
   
         return $ret;
       }
       ```
   
    -  This reply was modified 8 years, 3 months ago by [jonhs](https://wordpress.org/support/users/jonhs/).
    -  This reply was modified 8 years, 3 months ago by [jonhs](https://wordpress.org/support/users/jonhs/).

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

The topic ‘Shortcode insertion to extras.php help needed’ is closed to new replies.

 * ![](https://ps.w.org/add-to-any/assets/icon.svg?rev=972738)
 * [AddToAny Share Buttons](https://wordpress.org/plugins/add-to-any/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/add-to-any/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/add-to-any/)
 * [Active Topics](https://wordpress.org/support/plugin/add-to-any/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/add-to-any/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/add-to-any/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [jonhs](https://wordpress.org/support/users/jonhs/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/shortcode-insertion-to-extras-php-help-needed/#post-9888220)
 * Status: resolved