Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
tag-dropdown-widget.php 22.56 KiB
<?php
/*
Plugin Name: Taxonomy Dropdown Widget
Plugin URI: https://ethitter.com/plugins/taxonomy-dropdown-widget/
Description: Creates a dropdown list of non-hierarchical taxonomies as an alternative to the term (tag) cloud. Widget provides numerous options to tailor the output to fit your site. Dropdown function can also be called directly for use outside of the widget. Formerly known as <strong><em>Tag Dropdown Widget</em></strong>.
Author: Erick Hitter
Version: 2.1
Author URI: https://ethitter.com/

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

/**
 ** TAXONOMY DROPDOWN WIDGET PLUGIN
 **/
class taxonomy_dropdown_widget_plugin {
	/**
	 * Singleton!
	 */
	private static $__instance = null;

	/**
	 * Class variables
	 */
	protected $option_defaults = array(
		'taxonomy'        => 'post_tag',
		'select_name'     => 'Select Tag',
		'max_name_length' => 0,
		'cutoff'          => '&hellip;',
		'limit'           => 0,
		'order'           => 'ASC',
		'orderby'         => 'name',
		'threshold'       => 0,
		'incexc'          => 'exclude',
		'incexc_ids'      => array(),
		'hide_empty'      => true,
		'post_counts'     => false,
	);

	/**
	 * Implement the singleton
	 *
	 * @return object
	 */
	public static function get_instance() {
		if ( ! is_a( self::$__instance, __CLASS__ ) ) {
			self::$__instance = new self;

			self::$__instance->setup();
		}

		return self::$__instance;
	}

	/**
	 * Silence is golden!
	 */
	private function __construct() {}