Title: Fix
Last modified: August 21, 2016

---

# Fix

 *  [quacos](https://wordpress.org/support/users/quacos/)
 * (@quacos)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/fix-3/)
 * This widget modifies the global variable $post, modifying the behavior of other
   widgets. I used this fixed function:
 *     ```
       //Display the sidebar posts if there are any.
       function get_post_to_sidebar_data(){
       	global $post_to_sidebar;
       	global $post;
   
       	$post_bak = $post;
   
       	if ($post_to_sidebar) {
       		foreach ($post_to_sidebar as $post):
       		setup_postdata($post);
   
       		?>
       		<div class="post-to-sidebar">
   
       			<?php the_title('<h3 class="widget-title">', '</h3>'); ?>
   
       				<div class="sidebar-entry-content">
       					<?php the_content(); ?>
       					<?php edit_post_link('Edit', ' | ', ' | '); ?>
       				</div>
       		</div>
       		<?php
       		endforeach;
       		rewind_posts();
   
       		$post = $post_bak;
       		setup_postdata($post);
   
       		?>
       	<?php
       	}
       }
       ```
   
 * [http://wordpress.org/extend/plugins/post-to-sidebar/](http://wordpress.org/extend/plugins/post-to-sidebar/)

The topic ‘Fix’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/post-to-sidebar.svg)
 * [Post To Sidebar](https://wordpress.org/plugins/post-to-sidebar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-to-sidebar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-to-sidebar/)
 * [Active Topics](https://wordpress.org/support/plugin/post-to-sidebar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-to-sidebar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-to-sidebar/reviews/)

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [quacos](https://wordpress.org/support/users/quacos/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/fix-3/)
 * Status: not resolved