I have made a secure page for my client's website with

I have made a secure page for my client’s website with a table and calendar of all appointments made. I used these short codes:

[app_all_appointments title=”<h2>This week’s schedule</h2>” order_by=”start”]

[app_schedule worker=”1″ title=”” logged=””]

[app_pagination step=”1″]

Currently the table shows {Service, Provider, Client, Date/Time, Status}

I would like to remove the Provider column and insert a Phone Number and Email column.

Is there a simple short code fix to do this? Or can anyone help with a solution?

  • Vaughan
    • Ex Staff

    Hi Pablo,

    Hope you’re well?

    This would certainly need some custom code to achieve.

    I have not tested this,but hopefully it should work.

    Add the following to your theme functions.php or create a mu-plugin.

    add_filter( 'app_all_appointments_column_name', 'wpmu_app_all_apps_custom_columns' );
    function wpmu_app_all_apps_custom_columns() {
    $ret = '<th class="all-appointments-service">'. __('Service', 'appointments' )
    . '</th><th class="all-appointments-client">' . __('Client', 'appointments' )
    . '</th><th class="all-appointments-email">' . __('Client Email', 'appointments' )
    . '</th><th class="all-appointments-phone">' . __('Client Phone', 'appointments' )
    . '</th><th class="all-appointments-date">' . __('Date/time', 'appointments' )
    . '</th><th class="all-appointments-status">' . __('Status', 'appointments' ) . '</th>';

    return $ret;
    }

    add_filter('app-shortcode-all_appointments-after_client', 'wpmu_app_all_apps_custom_column_data');
    function wpmu_app_all_apps_custom_column_data($r) {
    global $appointments;

    $ret = '<td>' . $r->email . '</td>';
    $ret .= '<td>' . $r->phone . '</td>';

    return $ret;
    }

    Hope this helps

  • Pablo
    • WPMU DEV Initiate

    Hello Vaughan,

    Thanks for your speedy reply. The table has changed, however the data does not show up. Under client, the provider is showing up, and under email – the client name. The client phone and email are not being shown. The date/time and status are also shifted over one column. I have attached a screen shot of the table. [attachments are only viewable by logged-in members]

  • Vaughan
    • Ex Staff

    Hi Pablo,

    Hope you’re well?

    Can you try the following instead of the previouscode;

    add_filter( 'app_all_appointments_column_name', 'wpmu_app_all_apps_custom_columns' );
    function wpmu_app_all_apps_custom_columns() {
    $ret = '<th class="all-appointments-service">'. __('Service', 'appointments' )
    . '</th><th class="all-appointments-client">' . __('Client', 'appointments' )
    . '</th><th class="all-appointments-email">' . __('Client Email', 'appointments' )
    . '</th><th class="all-appointments-phone">' . __('Client Phone', 'appointments' )
    . '</th><th class="all-appointments-date">' . __('Date/time', 'appointments' )
    . '</th><th class="all-appointments-status">' . __('Status', 'appointments' ) . '</th>';

    return $ret;
    }

    add_filter( 'app_all_appointments_after_table', 'wpmu_app_all_apps_custom_column_data', 10, 2 );
    function wpmu_app_all_apps_custom_column_data($ret, $results) {
    global $wpdb, $appointments;

    $ret = preg_replace('/(<tbody[^>]*>)(.*?)(</table>)/i', '', $ret);
    if ( $results ) {
    foreach ( $results as $r ) {
    $ret .= '<tr><td>';
    $ret .= $appointments->get_service_name( $r->service ) . '</td>';
    $ret .= apply_filters('app-shortcode-all_appointments-after_service', '', $r);

    $ret .= '<td>';
    $ret .= $appointments->get_client_name( $r->ID ) . '</td>';
    $ret .= apply_filters('app-shortcode-all_appointments-after_client', '', $r);

    $ret .= '<td>' . $r->email . '</td>';
    $ret .= '<td>' . $r->phone . '</td>';

    $ret .= '<td>';
    $ret .= date_i18n( $appointments->datetime_format, strtotime( $r->start ) ) . '</td>';
    $ret .= apply_filters('app-shortcode-all_appointments-after_date', '', $r);

    $ret .= '<td>';
    $ret .= App_Template::get_status_name($r->status);
    $ret .= '</td>';
    $ret .= apply_filters('app-shortcode-all_appointments-after_status', '', $r);

    $ret .= apply_filters( 'app_all_appointments_add_cell', '', $r );
    $ret .= '</tr>';
    }
    } else {
    $colspan = substr_count($ret, '<th');
    $ret .= '<tr><td colspan="'.$colspan.'">'. __('No appointments','appointments'). '</td></tr>';
    }

    $ret .= '</tbody></table>';

    return $ret;
    }

    Be aware, there’s still an issue with the columns due to a bug in apps+ (I have already reported this to the developer soit should get fixed for next release.)

    In the meantime, to fix the bug:

    Open up & edit the following file;

    /wp-content/plugins/appointments/includes/class_app_shortcodes.php

    Find the following on line 586;

    $colspan = 5;

    Replace with;

    $colspan = substr_count($ret, '<th');

    That should fix the column alignments up. I tested this on my own site & it now displays the client email & phone.

    [attachments are only viewable by logged-in members]

    Hope this helps