Esempio n. 1
0
  static function show_our_team($param = null, $template = NULL){
  	parse_str($param);
  	global $wpdb;

  	// make sure we aren't calling both id and cat at the same time
  	if(isset($id) && $id != '' && isset($cat) && $cat != ''){
  		return "<strong>ERROR: You cannot set both a single ID and a category ID for your Team Directory</strong>";
  	}

    $query_args = array(
      'post_type' => 'team',
      'posts_per_page' => -1
    );

  	// check if it's a single team member first, since single members won't be ordered
  	if((isset($id) && $id != '') && (!isset($cat) || $cat == '')){
      $query_args['p'] = $id;
  	}
  	// ends single team

  	// check if we're returning a team category
  	if((isset($cat) && $cat != '') && (!isset($id) || $id == '')){
  		$query_args['tax_query'] = array(
        array(
          'taxonomy' => 'team_category',
          'terms' => array($cat)
        )
      );
  	}

    if(isset($orderby) && $orderby != ''){
      $query_args['orderby'] = $orderby;
    }
    if(isset($order) && $order != ''){
      $query_args['order'] = $order;
    }

    $team_query = new WP_Query($query_args);

    switch($template){
      case 'list':
        $output = OurTeamShortcode::html_for_list_template($team_query);
        break;
      case 'grid':
        $output = OurTeamShortcode::html_for_grid_template($team_query);
        break;
      default:
        $output = OurTeamShortcode::html_for_custom_template($template, $team_query);
        break;

    }

    wp_reset_query();

  	return $output;
  }
Esempio n. 2
0
Author URI: https://illusivedesign.ca
*/

global $wpdb;
$our_team_table = $wpdb->prefix . 'our_team';

define('OUR_TEAM_TABLE', $wpdb->prefix . 'our_team');
define('TEAM_TEMPLATES', $wpdb->prefix . 'our_team_templates');
define('STAFF_PHOTOS_DIRECTORY', WP_CONTENT_DIR . "/uploads/team-photos/");

require_once(dirname(__FILE__) . '/classes/team_settings.php');

TeamSettings::setupDefaults();

require_once(dirname(__FILE__) . '/classes/our_team.php');
require_once(dirname(__FILE__) . '/classes/our_team_shortcode.php');
require_once(dirname(__FILE__) . '/classes/our_team_admin.php');

OurTeam::register_post_types();
OurTeam::set_default_meta_fields_if_necessary();
OurTeamAdmin::register_admin_menu_items();
OurTeamShortcode::register_shortcode();

if (OurTeam::show_import_message()) {
	//OurTeamAdmin::register_import_old_team_message();
}

register_activation_hook( __FILE__, array('OurTeam', 'set_default_templates_if_necessary'));

?>