Title: mkalis's Replies | WordPress.org

---

# mkalis

  [  ](https://wordpress.org/support/users/mkalis/)

 *   [Profile](https://wordpress.org/support/users/mkalis/)
 *   [Topics Started](https://wordpress.org/support/users/mkalis/topics/)
 *   [Replies Created](https://wordpress.org/support/users/mkalis/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/mkalis/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/mkalis/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/mkalis/engagements/)
 *   [Favorites](https://wordpress.org/support/users/mkalis/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [All attachments view?](https://wordpress.org/support/topic/all-attachments-view/)
 *  [mkalis](https://wordpress.org/support/users/mkalis/)
 * (@mkalis)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/all-attachments-view/#post-883168)
 * I think you can just take it from the database. It would look something like 
   this. And take a look at the names used in the table – you can use all of those.
 *     ```
       global $wpdb;
       $attachments = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'posts WHERE post_type="attachment");
       foreach ($attachments as $attachment) {
          echo $attachment->post_title;
          // etc your code goes here (display what you want)
       }
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Dynamic Page-Specific Sidebars](https://wordpress.org/support/topic/dynamic-page-specific-sidebars/)
 *  [mkalis](https://wordpress.org/support/users/mkalis/)
 * (@mkalis)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/dynamic-page-specific-sidebars/#post-984470)
 * Hi, I did similar sidebars in my last template, and used something like this 
   in my functions.php:
 *     ```
       if ( function_exists('register_sidebar') ) {
       	$args = array(
       			'post_type'=>'page',
       			'post_parent'=>0,
       			'order'=>'DESC'
       			)
       	$pages = get_posts($args);
       	foreach ($pages as $page) {
       		register_sidebar(array('name'=>$page->post_title,
       	        'before_widget' => '<div id="%1$s" class="widget %2$s">',
       	        'after_widget' => '</div>',
       	        'before_title' => '<h2 class="widgettitle">',
       	        'after_title' => '</h2>',
       		));
       	}
       }
       function find_parent($id) {
       	$this_post = get_post($id);
       	if ( !$parent_id=$this_post->post_parent ) {
       		find_parent($parent_id);
       	} else {
       		return $id;
       	}
       }
       ```
   
 * I haven’t checked if it works, but apart from some minor mistakes – it should.
 * And then just put this in your sidebar.php and it should remove your manual labour
   afterwards.
 *     ```
       $parent_id = find_parent($post-ID);
       $parent_page = $get_page($parent_id);
       if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar( $parent_page->post_title ) ) echo "";
       ```
   
 * Just a note though – if your client deletes / changes the order of top-level 
   pages, the sidebars might jump from one page to another. Adding new pages without
   deleting the previous should work fine.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Cannot automatically upgrade plugins](https://wordpress.org/support/topic/cannot-automatically-upgrade-plugins/)
 *  [mkalis](https://wordpress.org/support/users/mkalis/)
 * (@mkalis)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/cannot-automatically-upgrade-plugins/#post-805108)
 * I tried a bit safer thing – I changed the permissions for wp-content to 777 (
   with no recursion), and the automatic update created a subdirectory ‘upgrade’
   with permissions 775 – so my guess is if you just create the subdirectory ‘upgrade’
   with permissions 775 it should work (I’ll test it when I need a new upgrade).

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