Builder Blocks: Events

(Difference between revisions)
Jump to: navigation, search
(Blanked the page)
Line 1: Line 1:
== Introduction ==
 
  
Need an easy way to do event registrations with WordPress? Our Builder Events Block with Eventbrite and Gravity Forms integration will do just that. Builder's Events Block makes it easy to get your event website up quickly by providing styling for several key event details such as location, date, time and attendee registration. In the midst of event planning, Builders Events Block makes your event website the easy part.
 
 
'''This plugin works with any Builder child theme. Note: It does not work in a non Builder theme.'''
 
 
* [http://demos.ithemes.com/events-block/ Events Block Demo Page]
 
* [http://ithemes.com/2012/05/01/just-released-builder-events-block/ Events Block release blog post]
 
* [http://ithemes.com/2012/03/29/coming-soon-new-builder-events-block/ Coming soon blog post]
 
* [http://ithemes.com/2012/04/11/sneak-peek-new-builder-events-block/ Sneak Peak (screenshots)]
 
 
== How to assign a layout to Events listing page ==
 
 
Add this code at the end of active theme's (child theme of Builder) functions.php:
 
 
<pre class="brush:php;">
 
function custom_filter_events_layout( $layout_id ) {
 
    if ( is_post_type_archive('it_bb_event') )
 
            return '4e57b7c528e6e';
 
   
 
    return $layout_id;
 
}
 
add_filter( 'builder_filter_current_layout', 'custom_filter_events_layout' );
 
</pre>
 
 
In the above, change "4e57b7c528e6e" to the ID of layout that you wish to assign to Events archive page.
 
 
To find the ID for a Layout, go to the Layouts listing, copy the edit link for the desired Layout, paste the link somewhere, and grab the text after the last equal sign. For example, consider the following link:
 
 
<pre>http://example.com/wp-admin/admin.php?page=layout-editor&editor_tab=layouts&layout=4e57b7c528e6e</pre>
 
 
The Layout's ID for the above is 4e57b7c528e6e.
 
 
==How to add start and end date and location to list of events==
 
Note, this applies to the WordPress backend, see image:
 
 
[[Image:BB_events_list.jpg|800px|none]]
 
 
Add the following code at the end of your child theme's functions.php file, but '''before the closing ?>''' (if any).
 
 
<pre class="brush: php; gutter: false;">
 
// Add fields to events columns
 
add_filter('manage_edit-it_bb_event_columns', 'my_it_bb_event_columns');
 
function my_it_bb_event_columns( $it_bb_event_columns ) {
 
 
    $new_columns['cb'] = '<input type="checkbox" />';
 
    $new_columns['title'] = __('Event Name', 'column name');
 
    $new_columns['event_start_date'] = _x('Start Date');
 
    $new_columns['event_end_date'] = _x('End Date');
 
    $new_columns['event_address'] = __('Location', 'event_address');
 
//    $new_columns['author'] = __('Author');  uncomment to show author
 
//    $new_columns['date'] = _x('Date Created', 'column name');  uncomment to show creation date
 
 
    return $new_columns;
 
}
 
 
// Get fields for events columns
 
add_action('manage_it_bb_event_posts_custom_column', 'my_it_bb_event_custom__columns', 10, 2);
 
function my_it_bb_event_custom__columns( $column_name, $id ) {
 
   
 
    $event_data = get_post_meta( $id , '_it_options' , true ) ;
 
       
 
    switch ($column_name) {
 
       
 
    // event start date
 
    case 'event_start_date':
 
        if ( $event_data[$column_name] )
 
            echo date_i18n( get_option( 'date_format' ) , strtotime( $event_data[$column_name] ) );
 
       
 
        break;
 
    // event end date       
 
    case 'event_end_date':
 
        if ( $event_data[$column_name] )
 
            echo date_i18n( get_option( 'date_format' ) , strtotime( $event_data[$column_name] ) );
 
       
 
        break;
 
       
 
    // event address, custom or venue
 
    case 'event_address':
 
 
        if ( ( !empty ( $event_data['default_location'] ) ) && ( ( $event_data['default_location'] !== 'custom' ) ) ) 
 
            $event_data = get_post_meta( intval( $event_data['default_location'] ) , '_it_options' , true ) ;
 
 
        echo nl2br( $event_data[$column_name] );
 
       
 
        break;
 
 
    default:
 
 
        break;
 
    }
 
   
 
    return;
 
}
 
 
// add custom fields to be sortable
 
add_filter( 'manage_edit-it_bb_event_sortable_columns', 'my_sortable_it_bb_event_columns' );
 
function my_sortable_it_bb_event_columns( $columns ) {
 
   
 
    $columns['event_start_date'] = 'event_start_date';
 
    $columns['event_end_date'] = 'event_end_date';
 
    $columns['event_address'] = 'event_address';
 
 
    return $columns;
 
}
 
</pre>
 

Revision as of 07:43, July 28, 2013

Personal tools
Namespaces
Variants
Actions
iThemes Codex
Codex Navigation
Toolbox