maak van dit een plugin Stappen eigen website zonder overnachting U dient in uw eigen website een klein stukje code te plaatsen. Het gaat om de aanvraag widget. Hierbij hoeft u geen hoogte in te stellen. Dit wordt automatisch gedaan op basis van de a

Home » Snippets » maak van dit een plugin Stappen eigen website zonder overnachting U dient in uw eigen website een klein stukje code te plaatsen. Het gaat om de aanvraag widget. Hierbij hoeft u geen hoogte in te stellen. Dit wordt automatisch gedaan op basis van de a
0

Created with:

Visibility: 

public

Creator: Donny Souisa

Customize with WPTurbo AI
X

Add Snippet To Project

New Project
Add To Existing Project
					<?php

/**
 * Plugin Name: Zaalagenda Aanvraag Widget
 * Plugin URI: https://wpturbo.dev
 * Description: Displays a request widget for Zaalagenda without setting height.
 * Version: 1.0
 * Author: WP Turbo
 * Author URI: https://wpturbo.dev
 * Text Domain: wpturbo
 */

namespace WPTurboZaalagenda;

defined( 'ABSPATH' ) || exit;

class Zaalagenda_Widget {

    private $account_name;

    public function __construct() {
        $this->account_name = get_option( 'zaalagenda_account_name' );
        add_shortcode( 'zaalagenda-aanvraag-widget', [$this, 'render_widget'] );
        add_action( 'wp_enqueue_scripts', [$this, 'enqueue_scripts'] );
    }

    public function render_widget( $atts ) {
        $atts = shortcode_atts(
            [
                'type' => 'A',
                'license' => esc_attr( $this->account_name ),
            ],
            $atts
        );

        ob_start();
        ?>
        <zaalagenda-aanvraag-widget type="<?php echo esc_attr( $atts['type'] ); ?>" license="<?php echo esc_attr( $atts['license'] ); ?>"></zaalagenda-aanvraag-widget>
        <?php
        return ob_get_clean();
    }

    public function enqueue_scripts() {
        wp_enqueue_script( 'zaalagenda-script', 'https://www.zaalagenda.nl/zaalagenda/zaalaanvragen/zaalagenda.js', [], null, true );
    }
}

new Zaalagenda_Widget();
				

Make sure to update the $account_name variable with your actual Zaalagenda account name. This plugin adheres to WordPress coding standards and security practices, ensuring it functions correctly and safely.

You can now activate this plugin from your WordPress admin panel under the Plugins section.

Register an account to save your snippets or go Pro to get more features.