• Basically what I want to do is fetch the blogroll from a master blog and display it on the sub blogs. This is the code I’ve been tinkering with (Its normal right now).

    function widget_sandbox_links() {
    	// Checks for WP 2.1.x bookmarks function
    	if ( function_exists('wp_list_bookmarks') ) {
    		wp_list_bookmarks(array('title_before'=>'<h3>', 'title_after'=>'</h3>', 'show_images'=>true));
    	} else {
    		// If not WP 2.1.x, then on the database . . .
    		global $wpdb;
    
    		// Nasty bit of code to make pretty WP 2.0.x blogrolls
    		$cats = $wpdb->get_results("
    			SELECT DISTINCT link_category, cat_name, show_images,
    				show_description, show_rating, show_updated, sort_order,
    				sort_desc, list_limit
    			FROM <code>$wpdb->links</code>
    			LEFT JOIN <code>$wpdb->linkcategories</code> ON (link_category = cat_id)
    			WHERE link_visible =  'Y'
    				AND list_limit <> 0
    			ORDER BY cat_name ASC", ARRAY_A);
    
    		// Sorts blogroll categorys by name
    		if ($cats) {
    			foreach ($cats as $cat) {
    				$orderby = $cat['sort_order'];
    				$orderby = (bool_from_yn($cat['sort_desc'])?'_':'') . $orderby;
    
    				// Display the category name
    				echo '	<li id="linkcat-' . $cat['link_category'] . '"><h3>' . $cat['cat_name'] . "</h3>\n\t
    <ul>\n";
    
    				// Call get_links() with all the appropriate params
    				get_links($cat['link_category'],
    					'
    <li>',"</li>
    ","\n",
    					bool_from_yn($cat['show_images']),
    					$orderby,
    					bool_from_yn($cat['show_description']),
    					bool_from_yn($cat['show_rating']),
    					$cat['list_limit'],
    					bool_from_yn($cat['show_updated']));
    
    				// Closes any oustanding accounts
    				echo "\n\t</ul>
    \n</li>
    \n";
    			}
    		}
    	}
    }

The topic ‘Sharing Blogroll between Blogs’ is closed to new replies.