Title: Not working inside foreach
Last modified: August 31, 2016

---

# Not working inside foreach

 *  Resolved [firstheartbeat15](https://wordpress.org/support/users/firstheartbeat15/)
 * (@firstheartbeat15)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/not-working-inside-foreach/)
 * I created a separate page for posts and i used foreach.
 * How can i display the sharing buttons inside the foreach??
 * Example.
    Below is a code from another plugin “addthis” and they used this.
 * do_action(‘addthis_widget’,get_permalink($post->ID), get_the_title($post->ID),‘
   below’);
 * For addtoany plugin, how can i do this?
 * [https://wordpress.org/plugins/add-to-any/](https://wordpress.org/plugins/add-to-any/)

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

 *  Thread Starter [firstheartbeat15](https://wordpress.org/support/users/firstheartbeat15/)
 * (@firstheartbeat15)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/not-working-inside-foreach/#post-7175890)
 * See image below
 * [http://postimg.org/image/817lhrd8j/](http://postimg.org/image/817lhrd8j/)
 *  Plugin Author [micropat](https://wordpress.org/support/users/micropat/)
 * (@micropat)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/not-working-inside-foreach/#post-7175984)
 * If you’re within [The Loop](https://codex.wordpress.org/The_Loop):
    `<?php if(
   function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) { ADDTOANY_SHARE_SAVE_KIT(); }?
   >`
 * Otherwise:
 *     ```
       <?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) {
           ADDTOANY_SHARE_SAVE_KIT( array( 'linkname' => get_the_title( $post->ID ), 'linkurl' => get_permalink( $post->ID ) ) );
       } ?>
       ```
   

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

 The topic ‘Not working inside foreach’ 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: [micropat](https://wordpress.org/support/users/micropat/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/not-working-inside-foreach/#post-7175984)
 * Status: resolved