描述
Multisite Directory provides a customizable Network-wide site directory for WordPress Multisite installations. You can categorize subsites in your Network, add full-length descriptions and featured images to them, and more. Theme developers can customize the look and feel of the site directory using all the tools they’re already familiar with. Blog authors can use a highly-configurable shortcode ([site-directory]
) to display the directory anywhere shortcodes are supported.
Each time a new site or blog is added to your Network, a corresponding entry in the site directory is added, too. The directory is managed from the Network’s main site, but most changes to the subsites (other blogs) automatically update the directory. Many parts of a given site’s appearance in the directory can be modified without affecting the site itself. This means a Super Admin can use a custom site logo, tagline, and so on in the directory itself, without changing the site’s actual logo, tagline, and so on. Additional options in the Network Settings → Network Directory section allows Super Admins to tweak the bells and whisltes, such as keeping Directory Entry titles in sync with Site Name changes.
Site directory entries are implemented as a hierarchical custom post type in the main site. These pages can be categorized with a custom subsite_category
taxonomy. We’ve found that this combination allows maximum flexibility while providing the tightest integration with existing WordPress core features. As a result, no new tables are added to your install, and no side effects are introduced. It Just Works.(TM)
Quickstart guide
After installing the plugin, you’ll want to:
- As a Super Admin, go to My Sites → Network Admin → Sites. Notice the new “Categories” link on the sidebar.
- Create some categories! If the category relates to a location (maybe it’s a site for a regional chapter of your organization?), be sure to click the map to geotag it.
- Click on “Directory,” immediately above “Categories.” These pages are the individual directory entries, not the blogs. Categorize these pages as you would regular WordPress Pages to organize your Site Directory.
- Go to any site’s Appearance → Widgets screen, and add a “Network Directory Widget” to a widget area.
- If you’ve geotagged some of your Site Categories, choose “Display as map” from the widget options. (Otherwise, leave it on “Display as list.”)
- Click Save, view your blog, and enjoy your new Site Directory!
Check out the Screenshots for a few examples.
This plugin provides a number of functions to Theme authors so that they can make use of the Multisite Network Directory features in their themes. This section documents those functions. For implementation details, see this plugin’s includes/functions.php
file.
get_site_directory_terms
Gets all categories in the site directory.
- @return array|false|WP_Error
Get site terms
Gets the categories assigned to a given blog in the network directory.
- @param int $blog_id
- @return array|false|WP_Error
the_site_directory_logo
Prints the site’s custom logo or the site directory entry’s featured image, if it has one.
- @param int $blog_id Optional. The ID of the site whose logo to get. Default is the current directory entry’s site’s logo.
- @param string|int[] $size
- @param string|string[] $attr
- @return void
屏幕截图
安装
Multisite Directory is for WordPress Multisite installations only. Do not use this plugin for single-site installs.
To manually install Multisite Directory:
- Upload the unzipped
multisite-directory.zip
file to the/wp-content/plugins/
directory. - 通过WordPress的的“Plugins”菜单激活插件
- Customize your site directory in the main site’s Dashboard.
常见问题
- Installation Instructions
-
Multisite Directory is for WordPress Multisite installations only. Do not use this plugin for single-site installs.
To manually install Multisite Directory:
- Upload the unzipped
multisite-directory.zip
file to the/wp-content/plugins/
directory. - 通过WordPress的的“Plugins”菜单激活插件
- Customize your site directory in the main site’s Dashboard.
- Upload the unzipped
- How do I customize the directory?
-
Edit your theme’s templates! 🙂 This plugin makes no assumptions about the look-and-feel of your directory so that any theme that wants to can customize it. You only need to customize your theme if you want to change the default appearance.
As a Theme author, you will probably want to create at least two new files:
archive-network_directory.php
taxonomy-subsite_category.php
The
archive-*
page is the main directory page. It will list all the sites in your multisite network. Thetaxonomy-*.php
page will list a subset of the sites in your network based on their categorization. You can customize these files as you would any other theme file.If you do not create these files, then the default WordPress template hierarchy will take over, meaning that either the
archive.php
orindex.php
template file in your main site’s currently active theme will be used to display the network directory itself and one oftaxonomy.php
orindex.php
will be used to display a filtered view of your directory’s categories. - How do I customize the map’s popups?
-
By default, when you click on a pin in the directory’s map view, you’ll see a list of links to the categorized subsites in your network, along with their site logo (if they have one). Most themes do not come with custom styles for map popups, so to customize their look and feel to match your site, you will need to write CSS to define a presentation for the lists yourself.
评价
贡献者及开发者
更新日志
0.2.3
- Updated translations and numerous compatibility improvements (props @hvianna).
- Protect against errors when mistakenly activated on a single-site WordPress install.
- Enhancement:
get_site_permalink()
now supports thescheme
parameter ofget_site_url()
. - Feature: Choose to keep Directory Entry titles in sync with Site Name changes.
- Bugfix: Fix bug where shortcode was always printed above post content.
0.2.2
- Adds
custom-fields
support to Site Directory entries. - Adds contextual help on the Site Directory post edit screen.
0.2.1
- Feature: Shortcake UI integration. (You must have the Shortcode UI plugin activated for this to work. Props @misfit.)
- Developer: You can now programmatically remove the geolocation interface from the Subsite Category admin pages. Use code such as
remove_action('subsite_category_edit_form_fields', array('Multisite_Directory_Taxonomy', 'edit_form_fields));
from a plugin or theme to do so.
0.2
- Feature: New shortcode argument
query_args
accepts a JSON string to pass toget_posts()
. - Bugfix: Remove front matter from rewrite rules.
- Note that this changes your permalink structure. If the network directory posts on your site are not showing up after you update, be sure to visit your Permalink settings screen and click “Save Changes” (without making any changes) to force a refresh.
- Numerous bugfixes.
0.1.2
- Bugfix: “Remove location” button on taxonomy edit screen correctly deletes term geolocation metadata.
0.1.1
- Bugfix: Fix PHP warning when no attributes are passed to the shortcode.
0.1
- First public release.