• Anybody found a workaround to show the time table of booked appointments on frontend? I imagine something like showing the back end time table available at admin.php?page=easy_app_reports on front end.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Gerald

    (@gerital)

    Finally I ended up writing a template for my theme. I first write all the events as JSON file and second made a theme template using fullcalendar to show them on front end.

    I”m looking for the same functionality.

    How do you create the JSON file?

    • This reply was modified 6 years, 8 months ago by wpdevturn.
    Thread Starter Gerald

    (@gerital)

    I use the following template code to write the JSON file:

    <?php
    /**
    	Template Name: Programació JSON
    
    	Gets all appointments and associated podcast data from DB
    */
    
    header('Content-Type: application/json; charset=utf-8');
    $fp = fopen('php://output', 'w');
    
    $params = array();
    
    $query_programacio = $wpdb->prepare("SELECT id,date,start
    	FROM wp_ea_appointments
    	WHERE date >= CURDATE()
    	ORDER BY date ASC,start",
    	$params
    );
    $programacio = $wpdb->get_results($query_programacio);
    
    //echo json_encode(array("data" => $programacio));
    
    $i = 0;
    foreach ($programacio as $prog) {
    	$query_podcast = $wpdb->prepare("SELECT value
    		FROM wp_ea_fields
    		WHERE app_id=$prog->id AND field_id=5",
    		$params
    	);
    
    	$podcast->id = (int)$wpdb->get_results($query_podcast)[0]->value;
    
    	$programacio[$i]->title = get_post($podcast->id)->post_title;
    	$programacio[$i]->author_id = get_post($podcast->id)->post_author;
    	$programacio[$i]->author_name = get_the_author_meta('display_name', $programacio[$i]->author_id);
    
    	$i++;
    }
    
    echo json_encode(array("podcasts" => $programacio));
    
    fclose($fp);
    
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show time table on frontend’ is closed to new replies.