WordPress.org

Ready to get started?Download WordPress

Forums

Blog Roll Edit (5 posts)

  1. thevegastourist
    Member
    Posted 4 years ago #

    I would like to use the BlogRoll as a way to list the sites on the network. So each time I activate a new site, I activate bloggroll and it will show the sites.

    So how do I edit the blogroll so it does this?? What/where are the links hardcoded in??

  2. David Sader
    Member
    Posted 4 years ago #

    So after say 100 sites are created, new site 101 will have 100 links in the blogroll? And when site 101 is created 100 previous sites will all have its link inserted into their respective blogrolls. That a lot of unscaleable cpu usage, I figure.

    New Blog Defaults plugin will let you add/replace the default_links in each blogroll newly created, but the list isn't generated dynamically, AFAIK. Easy-peasy plugin to use to customize just about everything in a new blog - I don't know if plugin is WP3.0 yet.

    Why not a dashboard widget which dynamically lists all blogs on each blog's dashboard, instead?

    That API plus the list all blogs code found in the themes/home/home.php could get something like this as a plugin:

    <?php
    function ds_dashboard_list_recent_blogs() {
    $blogs = get_last_updated();
    if( is_array( $blogs ) ) {
    	?>
    	<ul>
    	<strong>Updated Blogs</strong>
    	<?php foreach( $blogs as $details ) {
    		?><li><a href="http://<?php echo $details[ 'domain' ] . $details[ 'path' ] ?>"><?php echo get_blog_option( $details[ 'blog_id' ], 'blogname' ) ?></a></li><?php
    	}
    	?>
    	</ul>
    	<?php
    }
    }
    function ds_dashboard_list_recent_blogs_widget() {
    wp_add_dashboard_widget('ds_dashboard_list_recent_blogs_widget','Recently Updated Blogs','ds_dashboard_list_recent_blogs');
    
    }
    add_action('wp_dashboard_setup','ds_dashboard_list_recent_blogs_widget');
    ?>

    Similarily, you could code a widget for users to add a blog list to their sidebar.

    class ds_list_recent_blogs extends WP_Widget {
        /** constructor */
        function ds_list_recent_blogs() {
            parent::WP_Widget(false, $name = 'Recent Blogs');
        }
    
        /** @see WP_Widget::widget */
        function widget($args, $instance) {
            extract( $args );
            $title = apply_filters('widget_title', $instance['title']);
            ?>
                  <?php echo $before_widget; ?>
                      <?php if ( $title )
                            echo $before_title . $title . $after_title;
    
    $blogs = get_last_updated();
    if( is_array( $blogs ) ) {
    	?>
    	<ul>
    	<strong>Updated Blogs</strong>
    	<?php foreach( $blogs as $details ) {
    		?><li><a href="http://<?php echo $details[ 'domain' ] . $details[ 'path' ] ?>"><?php echo get_blog_option( $details[ 'blog_id' ], 'blogname' ) ?></a></li><?php
    	}
    	?>
    	</ul>
    	<?php
    }
    
    	                    echo $after_widget; ?>
            <?php
        }
    
        /** @see WP_Widget::update */
        function update($new_instance, $old_instance) {
    	$instance = $old_instance;
    	$instance['title'] = strip_tags($new_instance['title']);
            return $instance;
        }
    
        /** @see WP_Widget::form */
        function form($instance) {
            $title = esc_attr($instance['title']);
            ?>
                <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
            <?php
        }
    
    }
    add_action('widgets_init', create_function('', 'return register_widget("ds_list_recent_blogs");'));
  3. David Sader
    Member
    Posted 4 years ago #

    List All Blogs instead of Recently Updated:

    //$blogs = get_last_updated();
    $blogs = get_blog_list('0','all');

    Only blogs with privacy set to 1(Public) will be listed by either of these functions from ms-blogs.php

    http://wordpress.org/support/topic/402533

  4. thevegastourist
    Member
    Posted 4 years ago #

    As always, Thanks for the great information and feedback.

    Current plans call for my first MU site to be used as a magazine style format. Each site is a separate topic. Therefore, my staff and I are the only admins and users.

    I do have my eye set on a regular MU with multiple authors and site owners. So your answer helps in both cases.

    The support link you posted, helped a little. I go it to post the list of current sites, but its at the bottom of the page. I am trying to find an easy widget style for the side bar.

    I will try the other plugins.

    thanks

  5. David Sader
    Member
    Posted 4 years ago #

    http://markjaquith.wordpress.com/2006/03/04/wp-tutorial-your-first-wp-plugin/

    Copy and paste the widget I've written above into a .php file and upload it to your plugins directory.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags