Skip to content

Repository files navigation

Dropdown Multisite Selector

Requires at least: WordPress 6.0

Tested up to: WordPress 7.1

Requires PHP: 8.3

Stable tag: 1.0.0

License: GPLv2 or later

License URI: https://www.gnu.org/licenses/gpl-2.0.html

Description

This plugin lets you build a fully configurable dropdown field whose options act as links: when a visitor picks one, they are redirected to the matching URL. It was originally built for multisite networks to make navigation between subsites faster, but it now supports custom links as dropdown options too.

Ways to populate the dropdown

  • Manual list - define each option yourself: enter a name and the URL the visitor is redirected to when they choose it.
  • All network sites - automatically list every site in your WordPress Multisite Network as an option.
  • The user's sites only - list only the network sites where the current logged-in user is registered.

What you can customize

  • Label - set a label for the dropdown, or leave it empty for no label.
  • Placeholder - the first, non-clickable option (for example "Select branch", "Select country", "Choose side").
  • Sorting - order your manual list alphabetically, or reverse it so your most recent entries appear first.
  • Behaviour - send the visitor to the selected URL, or treat the URLs as images and load the chosen one into the [dms_target] container on the same page, without leaving it.

Once your settings are saved, display the dropdown with the [dms] shortcode or the bundled widget.

Shortcodes

[dms] - Renders the dropdown exactly as configured on the admin settings page.

[dms_manual name="" placeholder="" target="" options=""] - Renders a standalone dropdown that is independent of your saved settings. Accepts these attributes:

  • name - the dropdown label (leave empty for no label)
  • placeholder - the first option shown in the menu (for example "-- Select --")
  • target - "default" to open links in the same tab, or "blank" to open them in a new tab
  • options - comma-separated URL/name pairs in the form "url1|name1, url2|name2, url3|name3". The order within each pair is detected automatically, so "name|url" works too. Option names cannot contain a comma or a vertical bar, as both are used to separate the values.

An example:

[dms_manual name="Label" placeholder="--Select--" target="blank" options="https://duckduckgo.com|Trusted search engine, https://google.bg|Tracking search engine"]

[dms_target] - Marks the spot where the selected image is loaded. Place it anywhere on the same page as [dms] and set the behaviour to "Open in target section" on the settings page: choosing an option then swaps the image in this container instead of redirecting the visitor. If the behaviour is set to images but this shortcode is missing from the page, the dropdown shows a warning. Developers can also replace the container markup through the dms_target_filter filter.

Need extra functionality? Open an issue here and I'll see whether it can be added. Thanks to everyone who has shared ideas for improving this plugin.

Filters

Here are the filters you can use to modify the plugin's output:

  • dms_sites_arguments - control the attributes passed to get_sites() when the "Show all sites in the WordPress Multisite Network" option is selected.
  • dms_multisite_pairs - filter the results returned from get_sites().
  • dms_users_sites - control the sites when the "Show only the sites where the user is registered" option is selected.
  • dms_target_filter - replace the markup returned by the [dms_target] shortcode.

Installation

From your WordPress dashboard

  1. Visit 'Plugins > Add New'.
  2. Search for 'Dropdown Multisite Selector'.
  3. Activate Dropdown Multisite Selector from your Plugins page. To start building your dropdown, go to Settings -> Dropdown Multisite.

From WordPress.org

  1. Download 'Dropdown Multisite Selector'.
  2. Upload the 'dropdown-multisite-selector' directory to your '/wp-content/plugins/' directory, using your favorite method (ftp, sftp, scp, etc...).
  3. Activate it from your Plugins page.

Changelog

The full changelog is kept in readme.txt.

About

A WordPress Plugin for multisite purposes

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

Sponsor
SponsoredKunjungi sekarang
Promo