Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Element Class
- class vcAboutUsBlock extends WPBakeryShortCode {
- // Element Init
- function __construct() {
- add_action( 'init', array( $this, 'vc_element_mapping' ) );
- add_shortcode( 'vc_whoweare', array( $this, 'vc_html' ) );
- }
- public function vc_element_mapping() {
- vc_map(
- array(
- 'name' => __('Who we are component', 'text-domain'),
- 'base' => 'vc_whoweare',
- 'description' => __('Block for creating new component inside about us page', 'text-domain'),
- 'category' => __('Custom Components', 'text-domain'),
- 'params' => array(
- array(
- 'type' => 'textfield',
- 'holder' => 'h3',
- 'class' => 'title-class',
- 'heading' => __( 'Title', 'text-domain' ),
- 'param_name' => 'title',
- 'value' => __( 'Who we are', 'text-domain' ),
- 'description' => __( 'Box Title', 'text-domain' ),
- 'admin_label' => false,
- 'weight' => 0,
- ),
- array(
- 'type' => 'textarea',
- 'holder' => 'div',
- 'class' => 'desc-class',
- 'heading' => __( 'Text', 'text-domain' ),
- 'param_name' => 'description',
- 'value' => __( 'About us', 'text-domain' ),
- 'description' => __( 'Box Text', 'text-domain' ),
- 'admin_label' => false,
- 'weight' => 0,
- ),
- array(
- 'type' => 'attach_image',
- 'holder' => 'div',
- 'class' => 'image-class',
- 'heading' => __( 'Image 1', 'text-domain' ),
- 'param_name' => 'image1',
- 'admin_label' => false,
- 'weight' => 0,
- 'description' => __( 'Select image from media library.', 'text-domain' )
- ),
- array(
- 'type' => 'attach_image',
- 'holder' => 'div',
- 'class' => 'image-class',
- 'heading' => __( 'Image 2', 'text-domain' ),
- 'param_name' => 'image2',
- 'admin_label' => false,
- 'weight' => 0,
- 'description' => __( 'Select image from media library.', 'text-domain' )
- )
- )
- )
- );
- }
- public function vc_html( $atts ) {
- // Params extraction
- extract(
- shortcode_atts(
- array(
- 'title' => 'About',
- 'description' => '',
- 'image1' => '',
- 'image2' => '',
- ),
- $atts
- )
- );
- $image_src1 = wp_get_attachment_image_src($image1,'large');
- $image_src2 = wp_get_attachment_image_src($image2,'large');
- // Fill $html var with data
- $html = '
- <section class="WhoSec" id="whois">
- <div class="container">
- <div class="WhoDiv">
- <div class="row">
- <div class="col-md-6 col-sm-12">
- <div class="WhoDivText">
- <h2 data-aos="fade-up" data-aos-duration="1000" data-aos-easing="ease-in-out">'.$title.'</h2>
- <p data-aos="fade-up" data-aos-duration="1000" data-aos-easing="ease-in-out">'.$description.'</p>
- </div>
- </div>
- <div class="col-md-6 col-sm-12">
- <div class="WhoDivImg">
- <div class="WhoDivImg">
- <div class="WhoDivImages">
- <img src="<?php echo get_template_directory_uri(); ?>/images/WhoDivImg1.jpg" alt="">
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </section>
- <style>
- </style>
- ';
- return $html;
- }
- } // End Element Class
- new vcAboutUsBlock();
- // Element Mapping
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement