Skip to content

Instantly share code, notes, and snippets.

@LaFaucon

LaFaucon/functions.php

Last active Mar 31, 2016
Embed
What would you like to do?
wordpress / tribe events calendar: admin columns for venue and organizer
<?php
/* ADMIN - ADD COLUMN FOR ADDRESS INFO TO CALENDAR VENUES */
function add_calendar_venue_columns($columns) {
unset($columns['id']);
return array_merge($columns,
array(
'_VenueAddress' => __('Address'),
'_VenueCity' => __('City'),
'_VenueState' =>__('State'),
'_VenueZip' =>__('Zip'),
'_VenuePhone' =>__('Phone'),
'_VenueURL' =>__('URL')));
}
add_filter('manage_tribe_venue_posts_columns' , 'add_calendar_venue_columns');
add_action( 'manage_tribe_venue_posts_custom_column', 'calendar_venue_columns_content', 10, 2 );
function calendar_venue_columns_content( $column_name, $post_id ) {
if ($column_name == '_VenueAddress') {
$venueAddress = get_post_meta($post_id, '_VenueAddress', true);
echo $venueAddress;
}
if ($column_name == '_VenueCity') {
echo get_post_meta($post_id, '_VenueCity', true);
}
if ($column_name == '_VenueState') {
echo get_post_meta($post_id, '_VenueState', true);
}
if ($column_name == '_VenueZip') {
echo get_post_meta($post_id, '_VenueZip', true);
}
if ($column_name == '_VenuePhone') {
echo get_post_meta($post_id, '_VenuePhone', true);
}
if ($column_name == '_VenueURL') {
echo get_post_meta($post_id, '_VenueURL', true);
}
}
/* ADMIN - ADD COLUMN FOR ADDRESS INFO TO CALENDAR ORGANIZERS */
function add_calendar_organizer_columns($columns) {
return array_merge($columns,
array(
'_OrganizerEmail' =>__('Email'),
'_OrganizerPhone' =>__('Phone'),
'_OrganizerWebsite' =>__('Website')));
}
add_filter('manage_tribe_organizer_posts_columns' , 'add_calendar_organizer_columns');
add_action( 'manage_tribe_organizer_posts_custom_column', 'calendar_organizer_columns_content', 10, 2 );
function calendar_organizer_columns_content( $column_name, $post_id ) {
if ($column_name == '_VenueAddress') {
$venueAddress = get_post_meta($post_id, '_VenueAddress', true);
echo $venueAddress;
}
if ($column_name == '_OrganizerEmail') {
echo get_post_meta($post_id, '_OrganizerEmail', true);
}
if ($column_name == '_OrganizerPhone') {
echo get_post_meta($post_id, '_OrganizerPhone', true);
}
if ($column_name == '_OrganizerWebsite') {
echo get_post_meta($post_id, '_OrganizerWebsite', true);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.