Listing all sidebars

You can only gel list of registered sidebars, from variable $wp_registered_sidebars. <?php global $wp_registered_sidebars; echo ‘<pre>’; print_r($wp_registered_sidebars); echo ‘</pre>’;

adding a #hash to each link in list_pages()?

I”d wrap it in a function (save it in functions.php); function wp_list_pages_with_hash( $hash, $args=”” ) { $add_hash = create_function( ‘$link’, ‘return $link . “#’ . $hash . ‘”;’ ); add_filter( ‘page_link’, $add_hash ); $result = wp_list_pages( $args ); remove_filter( ‘page_link’, $add_hash ); return $result; // back compat in case ‘echo’ was null } Then call … Read more

How to display list of results

So you want to import textual content and preserve its formatting, as opposed to parsing it into HTML? I suppose the <pre></pre> tags are meant for exactly this. However I would consider spending osme effort to parse input after all, otherwise there is little merit in having it in WordPress.

Show 10 latest posts only from users with contributors role

you can use the author parameter of WP_Query here is a simple function to get you going with a hook to a shortcode and another hook to render this shortcode inside a simple text widget: function ten_latest_of_contributers($atts = null){ global $post; //store the current post data $temp = $post; $contributors = get_users(array(‘role’=> ‘contributor’)); //then create … Read more

Efficient way to fetch all archived WPMS blogs

You can go directly to the database via $wpdb. <?php $wpdb->get_results( “SELECT * FROM $wpdb->blogs WHERE archived = 1” ); Or wrapped up in a function: <?php function wpse34731_get_archived_blogs() { global $wpdb; if( empty( $wpdb ) ) return; $blogs = $wpdb->get_results( “SELECT * FROM $wpdb->blogs WHERE archived = 1” ); return $blogs; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)