I know that Stephen Rider is coming out with an update soon, but I needed another feature that I felt was useful enough to release publicly. I was using the Exec-PHP plugin to embed a call to the print_virtual_sites_list() function in a post on my root site (http://DPotter.net/), like this:

<ul><?php print_virtual_sites_list(); ?></ul>

This worked great, displaying the list of virtual sites. However, on that site my user has the visual editor enabled, so whenever I would edit that post the editor would convert that line to this:

<ul><!--p print_virtual_sites_list();--></ul>

Not good! The solution to this is to use keywords like I’ve seen in other plugins. This also required some changes to the functions provided in the mb-functions.php file.

Here are the keywords that are implemented in the DRP-Multi-Blog Keywords plugin:

  • [virtual_sites_list] – Displays a list of sites defined in the wp-config.php file.  This is a simple wrapper around the print_virtual_sites_list function.
  • [virtual_site_name] – Displays the name of the current site as specified in the wp-config.php file.
  • [virtual_site_url] – Displays the URL of the current site as specified in the wp-config.php file.
  • [virtual_site_config_file] – Displays the name of the configuration file.
  • [virtual_site_db] – Displays the name of the database.  Could be nothing if not specified.
  • [virtual_site_table_prefix] – Displays the table prefix string.  Could be nothing if not specified.

The result of these changes is that I can now specify the following line in my post:

<ul>[virtual_sites_list]</ul>

By the way, I previously released my last version as MultiBlog2.  That wasn’t a very nice thing to do as I don’t own the name, and when I read that Stephen was going to be releasing v2 of his solution I immediately felt bad.  In fact, the more I thought about it, I really should have named my solution something different so that I could version it independently.  As a result, I have renamed my solution as DRP-Multi-Blogging.  The previous release is now called DRP-Multi-Blogging v1.0 and this one is called DRP-Multi-Blogging v1.1.  My apologies, Stephen.  Hopefully there won’t be too much confusion out there.

Resources