display booking dashboard | WordPress.org

Where’s the screenshot?

Here’s a code snippet to create the shortcode [my-em-bookings] to display the recent bookings table (it contains the bookings for all of the events):

add_shortcode('my-em-bookings', 'my_em_bookings');
function my_em_bookings()
{
    ob_start(); ?>
    <div class="em-bookings-admin-dashboard em-bookings-dashboard <?php em_template_classes("bookings-admin'); ?>'>
        <div class="input">
        <div class="em-bookings-recent">
            <h2><?php esc_html_e('Recent Bookings','events-manager'); ?></h2>
            <?php
            $EM_Bookings_Table = new EM_Bookings_Table();
            $EM_Bookings_Table->output();
            ?>
        </div>
    </div>
    <?php
    return ob_get_clean();
}

You can use the Code Snippets plugin to add this code snippet.

  • This reply was modified 13 hours, 55 minutes ago by joneiseman.

I created a my-em-bookings plugin and created a php file with this content and when I activated the plugin it crashed, maybe there is an error in your script ?

<?php
/**

  • Plugin Name: mon-shortcode-em
  • Description: affichage des réservations events manager
  • Text Domain: clubdesplaisaix73
  • Version: 1.0
    */

function my_em_bookings()
{
ob_start(); ?>

output(); ?>

<?php
return ob_get_clean();

add_shortcode(‘my-em-bookings’, ‘my_em_bookings’);

Don’t copy it from the email. Copy it from the post.

I created the directory wp-content/plugins/mon-shortcode-em and in that directory I placed the file mon-shortcode-em.php

Here’s the content of mon-shortcode-em.php:

<?php
/*
Plugin Name: mon-shortcode-em
Description: affichage des réservations events manager
Text Domain: clubdesplaisaix73
Version: 1.0
*/

add_shortcode('my-em-bookings', 'my_em_bookings');
function my_em_bookings()
{
    ob_start(); ?>
        <div class="em-bookings-admin-dashboard em-bookings-dashboard <?php em_template_classes("bookings-admin'); ?>'>
                <div class="input">
                <div class="em-bookings-recent">
                        <h2><?php esc_html_e('Recent Bookings','events-manager'); ?></h2>
                        <?php
                        $EM_Bookings_Table = new EM_Bookings_Table();
                        $EM_Bookings_Table->output();
                        ?>
                </div>
        </div>
        <?php
        return ob_get_clean();
}
?>

I did not get any error when activating the plugin and using the shortcode worked fine.

  • This reply was modified 11 hours, 50 minutes ago by joneiseman.

Very good! The plugin works perfectly, again thanks for your help

best regards

Gérard

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer