PluginProbe
Services Section Block – present your services in clean grids and columns / 1.2.8
Services Section Block – present your services in clean grids and columns v1.2.8
1.4.6 1.4.5 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 trunk 1.0 1.1 1.1.1 All 33 releases
services-section / plugin.php

plugin.php in Services Section Block – present your services in clean grids and columns 1.2.8, at plugin.php

61 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Services Section - Block
4 * Description: Use Services Section Block to provide services of your business to clients with customizable settings.
5 * Version: 1.2.8
6 * Author: bPlugins LLC
7 * Author URI: http://bplugins.com
8 * License: GPLv3
9 * License URI: https://www.gnu.org/licenses/gpl-3.0.txt
10 * Text Domain: services-section
11 */
12
13 // ABS PATH
14 if ( !defined( 'ABSPATH' ) ) { exit; }
15
16 // Constant
17 define( 'SSB_PLUGIN_VERSION', 'localhost' === $_SERVER['HTTP_HOST'] ? time() : '1.2.8' );
18 define( 'SSB_ASSETS_DIR', plugin_dir_url( __FILE__ ) . 'assets/' );
19 define( 'SSB_SERVICE_PATTERN', plugins_url( 'dist/src/img/service-pattern.png', __FILE__ ) );
20
21 // Services Section Block
22 class ServicesSectionBlock{
23 function __construct(){
24 add_action( 'enqueue_block_assets', [$this, 'enqueueBlockAssets'] );
25 add_action( 'init', [$this, 'onInit'] );
26 }
27
28 function enqueueBlockAssets(){ wp_enqueue_style( 'fontAwesome', SSB_ASSETS_DIR . 'css/fontAwesome.min.css', [], '5.15.4' ); }
29
30 function onInit(){
31 wp_register_style( 'services-section-services-editor-style', plugins_url( 'dist/editor.css', __FILE__ ), [ 'wp-edit-blocks' ], SSB_PLUGIN_VERSION ); // Backend Style
32 wp_register_style( 'services-section-services-style', plugins_url( 'dist/style.css', __FILE__ ), [ 'wp-editor' ], SSB_PLUGIN_VERSION ); // Frontend Style
33
34 register_block_type( __DIR__, [
35 'editor_style' => 'services-section-services-editor-style',
36 'style' => 'services-section-services-style',
37 'render_callback' => [$this, 'render_services']
38 ] ); // Register Block
39
40 wp_set_script_translations( 'services-section-services-editor-script', 'services-section', plugin_dir_path( __FILE__ ) . 'languages' ); // Translate
41 } // Register
42
43 function render_services( $attributes, $content ){
44 extract( $attributes );
45
46 ob_start(); ?>
47 <div class='wp-block-services-section-services <?php echo 'align' . esc_attr( $align ); ?>' id='ssbServices-<?php echo esc_attr( $cId ); ?>' data-attributes='<?php echo esc_attr( wp_json_encode( $attributes ) ); ?>'>
48 <div class='ssbServicesStyle'></div>
49
50 <div class='ssbServices <?php echo esc_attr( $layout ); ?> columns-<?php echo esc_attr( $columns['desktop'] ); ?> columns-tablet-<?php echo esc_attr( $columns['tablet'] ); ?> columns-mobile-<?php echo esc_attr( $columns['mobile'] ); ?>'>
51 <?php echo wp_kses_post( $content ); ?>
52 </div>
53 </div>
54
55 <?php return ob_get_clean();
56 } // Render Services
57 }
58 new ServicesSectionBlock;
59
60 // Require files
61 require_once plugin_dir_path( __FILE__ ) . 'child/child.php';